SharePoint Development Blog

Nick Boumans
View my LinkedIn Profile Follow me on Twitter View my Profile on FaceBook View my projects on CodePlex View my presentations on SlideShare



Recent posts

Tags

Categories

Navigation

Pages

Archive

Blogroll

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

Adding and Deploying Solutions with PowerShell in SharePoint 2010

Visual Studio 2010 makes it really easy to add and deploy solutions when you are developing (the F5 experience), but you may eventually want to deploy those solution packages elsewhere then on your development machine. We can still use the stsadm tool, but that is effectively considered deprecated now in favor of PowerShell.

To get started with PowerShell, run the SharePoint 2010 Management Console located in your Microsoft SharePoint 2010 Products folder on your start menu. This automatically loads the Microsoft.SharePoint.PowerShell snappin so that we can execute SharePoint commands.

 


[code:xml]


Add-SPSolution c:\codefolder\SharePointSolution.wsp
Install-SPSolution –Identity SharePointSolution.wsp –WebApplication http://yoursharepointurl -GACDeployment
Update-SPSolution –Identity SharePointSolution.wsp –LiteralPath  c:\codefolder\SharePointSolution.wsp –GACDeployment
Uninstall-SPSolution –Identity SharePointSolution.wsp –WebApplication http://yoursharepointurl
Remove-SPSolution –Identity SharePointSolution.wsp

Also cool is getting your SharePoint version by using Powershell

function global:Get-SPFarm
{
       return [Microsoft.SharePoint.Administration.SPFarm]::Local
}
$farm = Get-SPFarm
$farm.BuildVersion

The result looks like

Major  Minor  Build  Revision
-----  -----  -----  --------
14     0      4536   1000
Posted: Dec 30 2009, 12:32 by Nick Boumans | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

An unexpected error has occurred - SharePoint Error Page

Lot of course participants of my development courses ask me how to fix the error: An unexpected error has occurred.

If you find nothing in the SharePoint Log you can modify the web.config

<SafeMode MaxControls="200" CallStack="true">
<customErrors mode="Off"/>

You will no longer see the "An unexpected error has occurred" error page and instead you get a lovely ’standard ASP.Net error page’ with the stack trace and everything! It is a best practice to do this on you're development environment. Don't forget to switch it on production!

 

Posted: Nov 17 2009, 23:04 by Nick Boumans | Comments (0) RSS comment feed |
  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Stsadm backup and restore scripts

Backup a sitecollection 

ECHO ON


SET SITECOLURL="mysitecollectionurl"
SET FILENAME="mybackup.bak"
SET STSADM="C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\bin\stsadm"


REM ----- Execute Site Collection Backup -----
%STSADM% -o backup -url %SITECOLURL% -filename %FILENAME%
%STSADM% -o execadmsvcjobs


pause

Restore a sitecollection

ECHO ON



SET SITECOLURL="mysitecollectionurl"
SET FILENAME="mybackup.bak"
SET STSADM="C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\bin\stsadm"



REM ----- Execute Site Collection Restore -----
%STSADM% -o restore -url %SITECOLURL% -filename %FILENAME%
%STSADM% -o execadmsvcjobs



pause
Posted: Sep 11 2009, 20:00 by Nick Boumans | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Filed under: Deployment

Deployment Batch File

Since a lot of developers use the SharePoint Solution Installer to install Windows Solution Packages (.WSP-files) the stsadm tool is manually used as well for soldution deployment and feature activation. The next .bat file could be used for general deployment using the stsadm.exe tool.

 

[code:c#]

@SET STSADM="c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm.exe"
@SET URL="http://mysharepointurl"
@SET WSPNAME="mysolution.wsp"
@SET FEATURENAME="myfeature"

%STSADM% -o deactivatefeature -name %FEATURENAME% -url %URL% -force
%STSADM% -o uninstallfeature -name %FEATURENAME% -force

%STSADM% -o retractsolution -name %WSPNAME% -url %URL% -local
%STSADM% -o deletesolution -name %WSPNAME% -override

%STSADM% -o addsolution -filename %WSPNAME%
%STSADM% -o deploysolution -name %WSPNAME% -url %URL% -local -allowGacDeployment

%STSADM% -o installfeature -name %FEATURENAME% -force
%STSADM% -o activatefeature -name %FEATURENAME% -url %URL% -force


iisreset /noforce

pause

[/code]

 

Posted: Nov 03 2008, 00:00 by Nick Boumans | Comments (0) RSS comment feed |
  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5