Introduction

This article will address the challenges around automation of SharePoint Online deployment.

Below artifacts can be developed through this technique,

  • List Definition
  • List Instance
  • Web part development
  • Template Development
  • JS Link webpart development 
  • Remote Timer Job
  • Remote Event Handler
  • etc.
You can combine any set of above artifacts in to a WSP solution.

Tool Description

This tool is responsible for activating the mandatory features for any site other than Publishing and Installing or Upgrading the WSP Solution to SPO O365 tenant site collection.

Below are the features activated using this tool,

  1.  SharePoint Server Publishing Infrastructure
  2.  SharePoint Server Publishing 

You can also extend the logic for activation of other feature by calling below,

PowerShell
Enable-SPOFeature -sSiteColUrl $SiteURL -spoCtx $Context -sFeatureGuid $FeatureGuidServerPublishing -IsSiteScope $False

Use below parameters while calling method,

  • $SiteURL - site collection URLL
  • $Context - Context of the sitee
  • $sFeatureGuid - Guid of feature to be activatedd
  • $True or $False - is site collection level featuree

Download Source

Click here to download Source

Environment Setup for remote machine

In order to enable SharePoint Online PowerShell Script execution from your remote machine. Click here for setup steps

Authentication and Execution Model


  

As depicted in above model diagram shows how PowerShell based tool help to authenticate, connect to SPO and on validation it helps to execute the CSOM based commandlets and deploy the WSP to perform deployment of different artifacts as packaged. Below are major component as depicted in diagram,

  1. SharePoint Online Mangement Shell
  2. Authentication component - while connecting to SharePoint Online tenant
  3. Validated Admin enable to process the execution to SPO
  4. SharePoint Tenant - Site Collection  Targeted destination for deployment

Run Execution Command

Below is the command will be helpful to execute the tool. Kindly modify the parameters before execution,

PowerShell
.\ApplyDesignPackageInstalltionAndUpgradeWSP.ps1 -User admin@xxxxxx.onmicrosoft.com -SiteURL "https://xxxxxx.sharepoint.com/sites/xxxxxx" -wspFullFilePath "C:\Amjad\<WSPBuildName>.wsp"  -WspFileName "<WSPBuildName>.wsp" -wspPackageName "<WSPBuildName>" -majorVersion 1 -minorVersion 0

 Parameters details are as below.

 Script can accept 7 parameters from the command line

  1. User
    •  mandatory - Administrator login ID for the tenant we are querying
  2. SiteURL
    •  mandatory - Destination Site URL for the tenant we are querying
  3. wspFullFilePath
    •  mandatory - Path of WSP location to upload from
  4. WspFileName
    •  mandatory - Name of WSP file   
  5. majorVersion
    •  Optional - majorVersion of the Build demployment or upgrade
  6. majorVersion
    •  Optional - minorVersion of the Build demployment or upgrade#