PowerShell and CSOM:Tool to Import Design Package WSP for SharePoint Online O365

Introduction

O365- SharePoint Online : This tool is responsible for activating the madatory features for any site other than Publishing and Installing or Upgrading the WSP Solution.

Below are the features,

1. SharePoint Server Publishing Infrastructure

2. SharePoint Server Publishing

Download Source

Click here to download Source

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 URL
$Context – Context of the site
$sFeatureGuid – Guid of feature to be activated
$True or $False – is site collection level feature

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#

# User – mandatory – Administrator login ID for the tenant we are querying

# SiteURL – mandatory – Destination Site URL for the tenant we are querying

# wspFullFilePath – mandatory – Path of WSP location to upload from

# WspFileName – mandatory – Name of WSP file

# wspPackageName – Optional – WSP Package Name for Solution Gallery

# majorVersion – Optional – majorVersion of the Build demployment or upgrade

# majorVersion – Optional – minorVersion of the Build demployment or upgrade#

Advertisements

Powershell and CSOM: Remote machine environment setup requirement

In order to enable SharePoint Online PowerShell Script execution from your remote machine, below are the steps required to follow on remote machine,

Step 1

SharePoint Server 2013 Client Components SDK – Download and Install at your Remote machine, Download SharePoint Server Client SDK .
This is required to enable usage of CSOM to your PowerShell script for O365 tenant.
Download as per available remote machine environment,

Install after download,

Step 2

Install Windows PowerShell 3.0 from Windows Management Framework 3.0 .

Step 3

Install the SharePoint Online Management Shell from the Microsoft Download Center .

Step 4

Set the policies, if not already set,

Check policies by using Windows PowerShell script command,

Get-ExecutionPolicy -List

The result will look similar to the following sample output:

Scope    ExecutionPolicy
—–    —————
MachinePolicy          Undefined
UserPolicy          Undefined
Process          Undefined
CurrentUser       RemoteSigned
LocalMachine          AllSigned

If not as above, use below command,

Set-ExecutionPolicy -ExecutionPolicy <PolicyName>

e.g to set CurrentUser policy,

Set-ExecutionPolicy -ExecutionPolicy  CurrentUser

When it ask for value use below,
Click here for detailed information on RemoteSigned
Hope you find this article useful.