We always think of having automation solution while deploying components in office 365 projects. I can also say it’s really challenging moving list, libraries, all out of the box development from Dev to other sites.

 

Using PowerShell and CSOM Combination, we can write script to automate deployment process. I have implemented few of the scripts to automate the deployment process, which I will be explaining in further articles. Let’s start with “How to connect Office 365 site from PowerShell editor?”

 

We have to prepare our machine to write script .Here is interesting part you can write the scripts in SharePoint (On-Premise) server or we can use our local system to write script.

Open windows power shell ISE with Run as administrator.

 

PowerShell ISE

 

If you get below error with respect to Machine policy then we just need to change the Execution policy of the system.

 

Error

 

Update Execution Policy as per below command but you need administrator access to run this command. Open the PowerShell editor as an administrator and then update the execution policy.

 

Execution Policy

 

As said earlier I am writing the scripts in my local system, so I need to keep all SharePoint DLL’s in local folder to provide the reference in script. You can copy the DLL’s from SharePoint server or download it from below URL .http://www.microsoft.com/en-ie/download/details.aspx?id=35585

 

I have created Library folder to keep all required .DLL files, which I’m referring in the code. Below code will create Term sets based on provided XML inputs.

 

Script Code:

 

Script Code

 

XML Input Values:

 

XML Input Values

 

Sambita
Sambita
Module Lead