SharePoint Online: Configure List Settings using PowerShell

Requirement: Edit List Settings in SharePoint Online using PowerShell.

How to Change List Settings in SharePoint Online?

List settings in SharePoint Online define the attributes of the list, such as Name, description, etc., and the functionality of the lists. These settings can be configured by navigating to the list settings page. This blog post will walk through the steps necessary to configure list settings.

To manage these settings, do the following:

  1. Navigate to the list or library Settings page from Settings >> List Settings. All settings of the list or library are located on this single page. From this page, You can configure List Name, Description, and Navigation options. Similarly, versioning, security, etc.
    sharepoint online edit list settings

SharePoint Online: PowerShell to Set List Settings

Updating the properties for a document library in SharePoint Online can be done manually, but if there are multiple libraries that need to be updated, it can be quite time-consuming. A PowerShell script can be written to automate this process and make it quicker and easier. Here is the PowerShell to update the most common properties of a SharePoint Online list or library:

#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

#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

#Allow management of content types? 

#Make "New Folder" command available?

#Enable Attachments: Applicable Only for Lists!

#Require content approval for submitted items? 

#Require documents to be checked out before they can be edited: Applicable Only for Libraries!

#Display this list using the new or classic experience? 
$List.ListExperienceOptions = "NewExperience" #ClassicExperience or Auto

#Draft Item Security
$List.DraftVersionVisibility = [Microsoft.SharePoint.Client.DraftVisibilityType]::Approver #Reader, Approver, Author

#Quick Edit - Allow items in this document library to be edited using Quick Edit and the Details Pane? 

#Offline Client Availability 
$List.ExcludeFromOfflineClient = $True

#Apply the settings to list

Write-host -f Green "List Settings Updated!"

You can also use this PowerShell script to update document library properties in SharePoint Online.

PnP PowerShell to Update Document Library Properties in SharePoint Online

To update the list or document library settings, we can use these PnP PowerShell scripts using the Set-PnPList cmdlet.

#Config Variables
$SiteURL = ""
$ListName ="Projects"

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

#Get the List
$List = Get-PnPList -Identity $ListName

#powershell script to update document library properties in sharepoint online
    #Enable versioning and set Number of versions to 50
    Set-PnPList -Identity $List -EnableVersioning $True -MajorVersions 50

    #Enable Content Type Management
    Set-PnPList -Identity $List -EnableContentTypes $True

    #Content Approval
    Set-PnPList -Identity $List -EnableModeration $True

    #Enable Folders
    Set-PnPList -Identity $List -EnableFolderCreation $True

    #Enable Attachments
    Set-PnPList -Identity $List -EnableAttachments $True 

    #Require Checkout
    Set-PnPList -Identity $List -ForceCheckout $True

    #Set List Experience
    Set-PnPList -Identity $List -ListExperience NewExperience

It is also possible to combine these operations in a single line. E.g.,

Set-PnPList -Identity $List -EnableAttachments $True -EnableContentTypes $True -EnableFolderCreation $True

Please note, the PnP PowerShell doesn’t provide parameters for all available properties of a SharePoint Online document library or list. So, you can use the following:

#Config Variables
$SiteURL = ""
$ListName ="Project Config"

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

#Get the List
$List = Get-PnPList -Identity $ListName

#Set List Property
$List.Hidden = $True

My other posts on configuring List settings in SharePoint Online using PowerShell:

Here is another article to get SharePoint Online List Settings: SharePoint Online: PowerShell to Get List Settings

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!

7 thoughts on “SharePoint Online: Configure List Settings using PowerShell

Leave a Reply

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