kwizcom banner advertisement

SharePoint Online: How to Change Site Title using PowerShell?

Requirement: Change Site Title in SharePoint Online

SharePoint Online: How to Change Title of a Site Collection?
To change site collection title in SharePoint Online,
  • Go to Site Settings Page >> Click on "Title, Description, and Logo" link under "Look and Feel"
  • Enter the new title for your site or site collection
    change site collection title in sharepoint online using powershell
  • Click "OK" to save your changes. This changes the site name. Now, lets use PowerShell to change site name in SharePoint Online.

PowerShell to Change Site Title in SharePoint Online:
Here is the PowerShell to change site or site collection title in SharePoint Online.
#Load SharePoint CSOM Assemblies
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll"
Add-Type -Path "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"

#Variables
$SiteURL="https://crescenttech.sharepoint.com/us"
$NewSiteTitle="United States"

Try {
    $Cred= Get-Credential
    $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password)
 
    #Setup the context
    $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
    $Ctx.Credentials = $Credentials

    #Get the Site from URL
    $Web = $Ctx.web
    $Ctx.Load($web)
    $Ctx.ExecuteQuery()
 
    #Get the current site title
    Write-host "Site Title:"$web.title

    #Update New Site Title
    $web.title = $NewSiteTitle
    $Web.Update()
    $Ctx.ExecuteQuery()
     
    Write-host "Site Title has been updated to '$NewSiteTitle'" -ForegroundColor Green  
}
Catch {
    write-host -f Red "Error Updating Site Title!" $_.Exception.Message
}
This PowerShell changes the site collection name to new name.
SharePoint Online: How to Change Site Title using PowerShell? SharePoint Online: How to Change Site Title using PowerShell? Reviewed by Salaudeen Rajack on January 24, 2018 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.