SharePoint 2016: How to setup Development Environment for CSOM based PowerShell Development
Since the evolution of PowerShell Development framework that can be used in conjunction with CSOM API of SharePoint. This type of development could be relatively more useful in scenarios where we do not have direct access to SharePoint Server and only client machines are accessible.
In this article, we will explore the steps that can be helpful in setting up the client machines for PowerShell development.
Following are the steps that we can follow to set up the client machines:
Step 1: Download Windows Management Framework 3.0
- Visit the following URL https://www.microsoft.com/en-us/download/details.aspx?id=34595
- Click Downloadhttps://howtodowithsharepoint.files.wordpress.com/2016/07/110.png?w=800
- Select “Windows6.1-KB2506143-x64.msu” file to download
- Click Next
https://howtodowithsharepoint.files.wordpress.com/2016/07/21.png?w=800
- Save the downloaded file to the local folder.
https://howtodowithsharepoint.files.wordpress.com/2016/07/31.png?w=800
Step 2: Install Windows Management Framework 3.0
- Run the Exe File “Windows6.1-KB2506143-x64.msu”
https://howtodowithsharepoint.files.wordpress.com/2016/07/41.png?w=800
Wait till the installer has been completed
https://howtodowithsharepoint.files.wordpress.com/2016/07/51.png?w=800
Step 3: Copy SharePoint CSOM DLLs
Add all the SharePoint CSOM DLLs from any SharePoint System to the local folder
https://howtodowithsharepoint.files.wordpress.com/2016/07/61.png?w=800
Step 4: Add the DLL references
Add a reference to the required SharePoint DLLs to the PowerShell Code
At the bare minimum we need to add the reference to the following two DLLs:
- Microsoft.SharePoint.Client.dll
- Microsoft.SharePoint.Client.Runtime.dll
https://howtodowithsharepoint.files.wordpress.com/2016/07/71.png?w=800
Step 5: Perform Configuration Test
- Write PowerShell code targeting SharePoint On-Premise Site
https://howtodowithsharepoint.files.wordpress.com/2016/07/81.png?w=800
- Run PowerShell script
https://howtodowithsharepoint.files.wordpress.com/2016/07/91.png?w=800
And sure enough, we will get the output of the PowerShell commands.
https://howtodowithsharepoint.files.wordpress.com/2016/07/101.png?w=800
The successful execution of the script proves that we have done the configuration correctly.