SharePoint Online: Set Site Column Properties using PowerShell

Requirement: Update Properties of a Site Column in SharePoint Online using PowerShell

How to edit a Site Column in SharePoint Online?

You can edit site column properties such as name, group, column type, etc in SharePoint Online by following the below steps:

  1. Navigate to the SharePoint Online site where the site column was created.
  2. Click on Settings Gear >> Site Settings
  3. On the Site Settings page, click on the “Site Columns” link under the “Web Designer Galleries” group
  4. On the Site Columns page, click the name of the site column to be edited.
  5. On the Edit Site Column page, You can make necessary changes and set whether all list columns based on this site column are to be updated to reflect your changes.
  6. Click the OK button to save the changes.sharepoint online update site column powershell

If the site column name is not clickable, then the site column may be created in the parent site. Navigate to the parent site as indicated by “Source Column” where the site column was created and then you can edit the site column.

SharePoint Online: Set Site Column Properties using PowerShell CSOM

Here is the PowerShell to update a field 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"

Function Set-SPOSiteColumn($SiteURL,$ColumnName)
    #Setup Credentials to connect
    $Cred = Get-Credential
    $Cred = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName,$Cred.Password)

    Try {
        #Setup the context
        $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
        $Ctx.Credentials = $Cred

        #Check if the site column exists
        $Fields = $Ctx.web.Fields
        $FieldNames = $Fields | Select -ExpandProperty InternalName

        #Get the site column from sharepoint online site
            #Get the site column
            $SiteColumn = $Fields.GetByInternalNameOrTitle($ColumnName)

            #Update Field Properties
            $Sitecolumn.Required = $True
            $Sitecolumn.Description="Current Status of the Project"
            #Use: $siteColumn.UpdateAndPushChanges() to push changes to all lists

            Write-host -f Green "Site Column Updated Successfully!"
            Write-host -f Yellow "Site Column doesn't Exist!"
    Catch {
        write-host -f Red "Error:" $_.Exception.Message

#Call the Function with Site URL and Internal Name of the Field
Set-SPOSiteColumn -SiteURL "" -ColumnName "ProjectName"

Update Site Column Properties using PnP PowerShell

#Config Variables
$SiteURL = ""
$FieldName = "ProjectStatus" #Internal Name

#Get Credentials to connect
$Cred = Get-Credential

Try {
    #Connect to PnP Online
    Connect-PnPOnline -Url $SiteURL -Credentials $Cred
    #Set Site Column Properties
    Set-PnPField -Identity $FieldName -Values @{Description="Current Status of the Project";Group="Crescent Site Columns V2"}    
catch {
    write-host "Error: $($_.Exception.Message)" -foregroundcolor Red

We also have a -UpdateExistingLists switch to update the site column in all existing Lists.

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

3 thoughts on “SharePoint Online: Set Site Column Properties using PowerShell

  • how to update the managed metadata column? I want to map a termset to the field

  • After running this script getting below error

    Add-Type : Cannot bind parameter ‘Path’ to the target. Exception setting “Path”: “Cannot find path ‘C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll’ because it does not exist.”

    Downloaded both the packages Client.dll and Client.Runtime.dll then also getting same error. Please help.


Leave a Reply