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
Developing SharePoint Solutions using Visual Studio 2010
On MSDN you can read about SharePoint 2010 Development walk-throughs: http://msdn.microsoft.com/en-us/library/ee231593%28VS.100%29.aspx
Visual Studio 2010 beta 2 SharePoint Development Samples: http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=SharePointDev2010&ReleaseId=3346
Sharepoint 2010 Beta Developer Training Kit
"The SharePoint 2010 Beta Developer Training Kit provides developers with deep guidance on how to develop for SharePoint 2010. Through PowerPoint decks, Hands-On Labs, Source Code, and Instructor-Led Videos, the developer kit walks you through an array of important developer topics--including Developer Roadmap, Visual Studio tooling, Workflow, Business Connectivity Services, and much, much more."
- Supported Operating Systems: Windows 7; Windows Server 2008 R2
To use the guidance properly, you'll need to have SharePoint Server 2010 Beta and Visual Studio 2010 Beta installed on a Windows operating system. Supported Operating Systems: Windows Server 2008 R2 (64 bit) and Windows 7 (64 bit).
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=bfd1603b-7550-4b8e-be85-4215a5069b90
Loading a custom menu build in Office into SharePoint WebPart
In Powerpoint and Word 2007 (and Word 2010) we can choose to save as: Single File Web Page (*.mht; *.mhtml). In this way we can make a nice graphical menu structure (using e.g. shapes and hyperlinks).
So I made a simple organogram and added hyperlinks to to shapes. This hyperlinks point to sharepoint pages. It looks like:
- Save your menu (or clickable presentation) as Single File Web Page (Not in PowerPoint 2010, here you have to choose Word).
- Upload the .mht file to a document library
- Add a Page Viewer WebPart to a Page
- Point the Page Viewer WebPart URL to the .mht file of that doc lib
Works in SharePoint 2007 (Office 2007) and SharePoint 2010 (Office 2010, however the optiion to save as single file web page has been removed in PowerPoint 2010 Beta).
Complete Single Server SharePoint 2010 installation using local accounts
In SharePoint 2007 we could choose a single server installation (which installed SQL Server express) or a Farm installation (which uses SQL non express). It was possible to use local accounts for the Farm Installation too.
In SharePoint 2010 we can’t use local accounts for the Farm Installation. However if you choose for single server installation you get SQL Server Express 2008. To Fix this on a development environment I came to the blogpost of Neil 'The Doc' Hodgkinson: http://sharepoint.microsoft.com/blogs/fromthefield/Lists/Posts/Post.aspx?List=0ce77946%2D1e45%2D4b43%2D8c74%2D21963e64d4e1&ID=112&Source=http%3A%2F%2Fsharepoint%2Emicrosoft%2Ecom%2Fblogs%2Ffromthefield%2FLists%2FPosts%2FAllPosts%2Easpx
This method worked for me on the public beta. The steps I followed:
- Choosed the farm installation method
- Didn’t run the configuration wizard directly after installation
- Installed SQL Server 2008 SP1 Fix: KB970315 x64
- Restarted IIS (If not I got problems in the following steps)
- Start Menu >> Microsoft SharePoint 2010 Products >> SharePoint 2010 Management Shell
- You get a SharePoint 2010 Management Shell (PS C:\Users\Username)
- Type: New-SPConfigurationDatabase
- DatabaseName: SharePoint_2010_ConfigDB
- DatabaseServer: e.g. DEV (It’s your computername)
- Now your prompted for the Farm Credentials. Please insert them
- The last step in insert a Passphrase: you can choose some of your own
- After this completes you will find in SQL a new configuration database and an admin content database
- Run the SharePoint Products Configuration Wizard
- Choose: Do not disconnect form this server farm (it takes your config database and database server automatically)
- Follow the other steps in the wizard
Note: For development environments only. Don't use this at a production environement. Set your password expiration to 0 days (never).
Microsoft SharePoint Connections 2010 Amsterdam
I will attend the Microsoft SharePoint Connections in Amsterdam at 18-19 January 2010:
"Missed a session at the SharePoint Conference in Las Vegas?, Couldn't make it at all? Block your agenda for 18th and 19th of January for the Microsoft SharePoint Connections 2010, in Amsterdam RAI!
The conference in Amsterdam contains all highlights presented at the international SharePoint Conference in Las Vegas. The SharePoint Connections conference also offers networking opportunities to engage with SharePoint partners, experts, speakers and partners who are exhibiting. And don't forget the SharePint on Monday evening. A tradition in the SharePoint world. Work with SharePoint during the day, talk about SharePoint while drinking a beer at night.
The SharePoint event of the year highlights over 40 sessions for IT-Pro, Developers and end-users. Sessions will be delivered by SharePoint Experts from Europe and the USA. If you want to get even more details after the conference register for the special Post Conference where you well get very detailed information in the IT Pro and Developer workshops."
For more info and tickets: http://www.devconnections.com/shows/NED2010SP/default.asp?s=149
Adding a Ribbon to SharePoint 2010
If you take a look to HOL10 - Developing SharePoint 2010 User Interface Ribbon and Dialog Customizations: http://www.microsoft.com/downloads/details.aspx?FamilyID=c010fc68-b47f-4db6-b8a8-ad4ba33a35c5&displaylang=en you will notice that this Hands on Lab will not work for the public beta. If you want to follow this lab and make it work, please update your elements.xml to the next code:
<?xml version="1.0" encoding="utf-8"?>
<!-- also take a look at: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\GLOBAL\XML\CMDUI.XML -->
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="Hello_world"
RegistrationType="List"
RegistrationId="101"
Location="CommandUI.Ribbon"
Sequence="5">
<CommandUIExtension>
<CommandUIDefinitions>
<CommandUIDefinition Location="Ribbon.Documents.Manage.Controls._children">
<Button
Id="Ribbon.Documents.New.DemoHelloWorldButton"
Alt="Hello World Ribbon Button"
Sequence="5"
Command="Demo_HelloWorld"
Image32by32="_layouts/images/YourProject/YourImage.jpg"
LabelText="Hello World Demo"
TemplateAlias="o1"/>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="Demo_HelloWorld"
CommandAction="javascript:alert('Hello World!');" />
</CommandUIHandlers>
</CommandUIExtension>
</CustomAction>
</Elements>
[/code]
You can view this Ribbon if you navigate to the Documents Folder. If you want to make a Ribbon visible on other places (e.g. page which actually is a WikiPageTab) take a look to this file: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\GLOBAL\XML\CMDUI.XML in your SharePoint root. In the CMDUI.XML you can find the definitons of the default Ribbons which could be helpfull to extend it with your own. E.g. you can find group ID's and sequences of the Ribbons.
If you want to extend the SiteActions menu you can take a look at the next elements.xml code
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="UserInterfaceCustomActions.SiteActionsToolbar"
GroupId="SiteActions"
Location="Microsoft.SharePoint.StandardMenu"
Sequence="1000"
Title="MY SITE ACTIONS BUTTON">
<UrlAction Url="javascript:alert('Hello World!');"/>
</CustomAction>
</Elements>
Add an assembly to your Visual Studio 2010 SharePoint Package
If you are familiar with WSP-builder for development with SharePoint 2007, the way of adding assemblies to your SharePoint 2010 project is a little different. You always start with an empty SharePoint project. From here you can add other items. In WSP-builder you had the bin and GAC folder in Visual Studio.
To add an assembly to your Visual Studio 2010 SharePoint Package (SharePoint 2010)
- Open you Package.package file.
- On the bottom of the window you can choose: Design | Advanced | Manifest
- Choose Advanced
You can choose for an excisting assembly or the output assembly of your project.
You can deploy the assembly to the GAC (C:\Windows\Assembly - The Global Assembly Cache, full trusted) or the WebApplication (actually the Bin Folder of your WebApplication in your InetPub folder of your WebServer).
Turn Developer Dashboard on or off in SharePoint 2010
You can turn the Developer Dashboard on or off by using the next .bat file. Make sure you run this file as administrator. Otherwise a message "access denied" will be shown.
ECHO ON
SET STSADM="C:\Program Files\Common Files\Microsoft Shared\web server extensions\14\bin\stsadm"
REM ----- Choose one of this three commands -----
REM ----- Turn Developer Dashboard ondemand -----
%STSADM% -o setproperty -pn developer-dashboard -pv ondemand
REM ----- Turn Developer Dashboard on -----
%STSADM% -o setproperty -pn developer-dashboard -pv on
REM ----- Turn Developer Dashboard off -----
%STSADM% -o setproperty -pn developer-dashboard -pv off
pause
Installing SharePoint 2010 on Windows 7
Installation Guide
A nice feature of SharePoint 2010 (Foundation and Server) is that you can install a single server environment on Windows 7. Waning, only use this type of installation for development purposes. After downloading a copy of SharePoint 2010 (beta at the moment) from e.g. MSDN you can’t directly install it on Windows 7. If you try to run the installer as administrator you get a message like: “Setup is unable to proceed due to the following error(s): This product requires Windows Server 2008 (x64). Correct the issue(s) listed above and re-run setup.”
To install it on Windows 7 you have to follow the next steps:
-
Copy the installer to your harddrive of installation (e.g. C:\sharepoint)
-
Rename the installer to spinstaller.exe
-
Extract the installation files by opening a Command Prompt (Run > CMD)
-
Type: C:\sharepoint\spinstaller /extract:c:\sharepoint
-
This will extract the installer
-
Navigate in your Windows Explorer to: c:\sharepoint\files\setup\config.xml
-
Edit this file in notepad and add the next line <Setting Id="AllowWindowsClientInstall" Value="True"/> just before the </Cofiguration> tag (Case sensitive)
-
Save the configuration file
-
Make sure the next Windows Features are turned on (Control Panel > Turn Windows Features on or off):
//You can do this quickly by copying and running the following command in a Command Prompt window.
//The following text contains line breaks. You must remove the line breaks to run this script from a command prompt.
start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;
IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;
IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;
IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-HealthAndDiagnostics;
IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;
IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;
IIS-RequestFiltering;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;
IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-IIS6ManagementCompatibility;
IIS-Metabase;IIS-WMICompatibility;WAS-WindowsActivationService;WAS-ProcessModel;
WAS-NetFxEnvironment;WAS-ConfigurationAPI;WCF-HTTP-Activation;WCF-NonHTTP-Activation
-
Install SharePoint 2010 by running c:\sharepoint\setup.exe as administrator
-
Choose the installation you want: Standalone (Installs SQL Server Express)
-
After the installation is complete you, will be prompted to start the SharePoint Products and Technologies Configuration Wizard. Before starting the wizard, first install the Microsoft SQL Server 2008 KB 970315 x64.
-
-
After the Microsoft SQL Server 2008 KB 970315 x64 installation is finished, complete the wizard. If it is closed you can find it in your start menu.
-
Note: you can even install SharePoint 2010 on Windows Vista. Please visit http://msdn.microsoft.com/en-us/library/ee554869(office.14).aspx for more information.
Trouble Shooting
- If the configuration wizard breaks at step 2, showing the next error message: "System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.IdentityModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified." a dll of the Geneva Framework is missing. Please install this framework containing the DLL and run the wizard againg. The next link contains the right dll: Download Geneva Framework.
- If the configuration wizard breaks at step 8, showing the next error message:
The WCF-NonHttp-Activation Windows Feature isn't checked. If you followed the tutorial on MSDN: http://msdn.microsoft.com/en-us/library/ee554869(office.14).aspx and didn't use the script but cross checked the features with the screenshots in the article, you missed this feature. Activate it (command prompt: start /w pkgmgr /iu:WCF-HTTP-Activation;WCF-NonHTTP-Activation;) or by Control Panel > Programs > Turn Windows Features on or off.