Building sponline powershell cmdlets

  1. Download the source code provided under the source code tab
  2. Open the solution in VS.NET 2012, ensure that you have references to Microsoft.SharePoint.Client, Microsoft.SharePoint.Client.Runtime, Microsoft.SharePoint.Client.Taxonomy, Microsoft.SharePoint.Client.Publishing, Microsoft.SharePoint.Client.UserProfiles
  3. Build the project
  4. In the build folder (debug or release depending on your settings) you will find Office365.SharePointOnline.Cmdlets. This dll contains the new cmdlets

Using the cmdlets

  1. Open a powershell prompt
  2. Type Import-Module -Verbose -Name {path to Office365.SharePointOnline.Cmdlets}
  3. The output will show you which cmdlets are ready for use
  4. Get-Help {cmdlet name} will show you the man page for the cmdlet
  5. In the parameter AuthenticationMethod you can specify SharePointOnline or OnPremise. If you specify OnPremise, you will also need to specify your domain.

Example of usage:
Set-MasterPage -Url -MasterPageUrl {relative url to masterpage} -SystemMasterUrl {relative url to masterpage} -User {your username} -Password {your password} -AuthenticationMethod SharePointOnline -Verbose
If you want to run the same cmdlet on premises you specify the -Domain parameter and for authentication method you specify the OnPremise.

The main idea is that it should not matter where you are using the cmdlets, be it in SharePoint Online, be it OnPremises. This will enable you to do development / test / acceptance / production with the same install script, keeping environments similar for easier troubleshooting.

Last edited Jul 31, 2013 at 9:13 PM by rbethleh, version 4


No comments yet.