SharePoint Online: Get List Field Properties using PowerShell

Requirement: Get List Field Settings in SharePoint Online using PowerShell.

PowerShell to Get Field Properties in SharePoint Online

This PowerShell script gets you the common properties from a SharePoint Online list field:

#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"

#Set Config Parameters
$ListName="PMO Projects"
$FieldName="HeadCount" #Internal Name

#Get Credentials to connect
$Cred= Get-Credential

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

#Get the List

#Get the List Field

#Get List Field Settings
Write-host "Title:"$Field.Title
Write-host "Description:"$Field.Description
Write-host "Default Value:"$Field.DefaultValue
Write-host "Unique Values:"$Field.EnforceUniqueValues
Write-host "Is Hidden:"$Field.Hidden
Write-host "Field ID:"$Field.Id
Write-host "Indexed:"$Field.Indexed
Write-host "InternalName:"$Field.InternalName
Write-host "Required Field:"$Field.Required
Write-host "Sortable:"$Field.Sortable
Write-host "Filterable:"$Field.Filterable
Write-host "Type:"$Field.TypeAsString
Write-host "Type Display Name:"$Field.TypeDisplayName
Write-host "Sealed:"$Field.Sealed
Write-host "Can Be Deleted:"$Field.CanBeDeleted
Write-host "Read Only Field:"$Field.ReadOnlyField
Write-host "Group:"$Field.Group
Write-host "Field Scope:"$Field.Scope
Write-host "JSLink:"$Field.JSLink
Write-host "Schema XML:"$Field.SchemaXML
Write-host "Validation Formula:"$Field.ValidationFormula
Write-host "Validation Message:"$Field.ValidationMessage

PnP PowerShell to Get Column Settings from a SharePoint Online List

Use the Get-PnPField cmdlet in PnP PowerShell to get the field and its properties:

$SiteURL = ""
$ListName = "Projects"
$ColumnName = "Status" #Internal Name

Try {
    #Connect to PnP Online
    Connect-PnPOnline -Url $SiteURL -Interactive

    #Get the Field
    $Field = Get-PnPField -List $ListName -Identity $ColumnName
    #Get properties of the Field
    $Field | Select Title, ID, TypeAsString, Required
catch {
    write-host "Error: $($_.Exception.Message)" -foregroundcolor Red

To get all available property values of the filed (or any object), use the following:

$Field | Select -Property *

By using these scripts, you can easily get column settings in SharePoint Online using PowerShell.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

One thought on “SharePoint Online: Get List Field Properties using PowerShell

  • Hello: I will like to unhide the internal column FileDirRef. Any suggestions if this can be done.


Leave a Reply

Your email address will not be published. Required fields are marked *