SharePoint Online: Update Content Type using PowerShell
Requirement: Update content type settings in SharePoint Online using PowerShell
How to Update Content Type Settings in SharePoint Online?
To editing content type's general settings such as name, description, and group information, follow these steps:
SharePoint Online: Update Content Type using PowerShell
Lets update content type name, description and group using PowerShell
How to Update Content Type Settings in SharePoint Online?
To editing content type's general settings such as name, description, and group information, follow these steps:
- Navigate to the SharePoint Online site where the content type was created.
- Click on Settings >> Site Settings
- On the Site Settings page, Click on "Site Content Types" link under "Web Designer Galleries" section.
- On the Site Content Types page, click the name of the content type to be edited.
- On the edit page, click the "Name,Description, and Group" link in the Settings section.
- On the Content Type Settings page, You can update the Name, Description, and Group information as necessary.
- Click OK button to save your changes.
SharePoint Online: Update Content Type using PowerShell
Lets update content type name, description and group using PowerShell
#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" #parameters $SiteURL="https://crescent.sharepoint.com/sites/projects" $ContentTypeID="0x01002A7A908ACAB0054880702EE263AC762B" #Get Credentials to connect $Cred= Get-Credential Try { #Setup the context $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password) #Get content type by ID $ContentType = $Ctx.web.ContentTypes.GetById($ContentTypeID) $Ctx.Load($ContentType) $Ctx.ExecuteQuery() #sharepoint online update content type powershell If($ContentType -ne $Null) { #Update Content Type Settigs $ContentType.Name = "Crescent Project Proposal V2" $ContentType.Description="Project Proposal Content Type with Template V2" $ContentType.Group = "Crecent Projects" $ContentType.Update($False) $Ctx.ExecuteQuery() Write-host -f Green "Content Type Settings Updated Successfully!" } else { Write-host "Content Type '$ContentTypeName' doesn't exist!'" -f Yellow } } Catch { write-host -f Red "Error:" $_.Exception.Message }Here is my related posts:
No comments:
Please Login and comment to get your questions answered!