CSOM SharePoint Online PowerShell - Manipulating Web Settings
CSOM SharePoint Online PowerShell - Manipulating Web Settings
Summary
This TechNet Wiki is to demo PowerShell code to manipulate Web Settings.
Assumptions
Assuming you have downloaded the SharePoint Online Client SDK. If not refer to this article.
Disable Quick Launch
Add-Type -Path 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll' #Mysite URL $site = 'https://domain.sharepoint.com/' #Admin User Principal Name $admin = 'Chendrayan@domain.OnMicrosoft.Com' #Get Password as secure String $password = Read-Host 'Enter Password' -AsSecureString #Get the Client Context and Bind the Site Collection $context = New-Object Microsoft.SharePoint.Client.ClientContext($site) #Authenticate $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($admin , $password) $context.Credentials = $credentials $web = $context.Web $context.Load($web) $context.ExecuteQuery() $web.QuickLaunchEnabled = $false $web.Update() $context.ExecuteQuery() |
Before Execution
After Execution
Change Title of the Web
Add-Type -Path 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll' #Mysite URL $site = 'https://domain.sharepoint.com/' #Admin User Principal Name $admin = 'Chendrayan@domain.OnMicrosoft.Com' #Get Password as secure String $password = Read-Host 'Enter Password' -AsSecureString #Get the Client Context and Bind the Site Collection $context = New-Object Microsoft.SharePoint.Client.ClientContext($site) #Authenticate $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($admin , $password) $context.Credentials = $credentials $web = $context.Web $context.Load($web) $context.ExecuteQuery() $web.Title = 'This is Set By CSOM' $web.Update() $context.ExecuteQuery() |