Over the coming few weeks, I’m going to release some of the CSOM, SharePoint Online and PowerShell scripts that I use on a daily basis and use to deploy and configure our customers. Any questions please do add them to the comments section and I’ll do my best to answer them.
I’ll also through in a few other PowerShell scripts that I use for SharePoint Online and hope you find them useful.
To make them easy to publish meaning I can do more and more and try and get them out as quickly as possible. Here is a quick explanation of what to look out for in the script.
Add-Type –Path I:UsersAlexSkyDriveDeploymentbinMicrosoft.SharePoint.Client.dll
Add-Type –Path I:UsersAlexSkyDriveDeploymentbinMicrosoft.SharePoint.Client.Runtime.dll
This will import the 2 SharePoint DLLs required to complete commands and connect to Office 365. Download them from the internet or get them from your SharePoint server.
We then need to connect to the environment giving a URL, username and password.
$username = “email@example.com”
$password = Read-Host -Prompt “Enter password” -AsSecureString
$siteUrl = “https://bfcnetworks.sharepoint.com/”
When you run this script, you will get a pop out window asking for the password for the user you are connecting as.
We now connect using the URL, username and password using the DLLs.
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $password)
$ctx.Credentials = $credentials
And to finish off, we load the SIte/Web.
$web = $ctx.Web
You will see this section a lot as it loads what we are asking for from SharePoint
Each post will include this but this post will be used as a guide.
I personally like to use the Windows PowerShell ISE so give it a go yourselves.