SharePoint Online: Get List Experience Settings using PowerShell

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

How to Get SharePoint Online List Experience?

Do you ever need to know the list experience settings applied in a SharePoint Online site? Maybe you’re troubleshooting an issue and had to confirm that the setting is configured as expected. Or, perhaps you’re curious about what list experience is configured for all lists and libraries. In any case, if you want to get the experience settings for SharePoint Online lists, I will show you how to audit them.

To get list experience configuration of a list or library in SharePoint Online,

  1. Navigate to the list or library settings >> Click on the “Advanced Settings” link.
  2. In the advanced settings page, under “List Experience”, you can get the list experience of the current list.
    sharepoint online list experience

Alternatively, you can also get the list experience settings in SharePoint Online using PowerShell scripts.

Retrieve List Experience using PowerShell:

To get the list experience settings in SharePoint Online, you can use the following PowerShell script.

Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking

#Set Parameters for Site URL and List Name
$SiteURL= "https://crescent.sharepoint.com/sites/marketing"
$ListName= "Documents"
 
#Setup 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 the List
    $List=$Ctx.Web.Lists.GetByTitle($ListName)
    $Ctx.Load($List)
    $Ctx.ExecuteQuery()

    #Get list Experience
    Write-host $List.ListExperienceOptions
}
Catch {
    write-host -f Red "Error Getting List Experience Settings!" $_.Exception.Message
}

PowerShell to Get List Experience Settings in SharePoint Online Site Collection

We wanted to audit list experience settings for all lists in a SharePoint Online site collection. Here is the PowerShell script to extract all list settings to a CSV file:

#Function to get list experience of all lists in a given web
Function Get-PnPListExperience($Web)
{
    Write-host "Processing Web:"$Web.URL -f Yellow
    Connect-PnPOnline -Url $Web.URL -Interactive

    #Get All Lists from Web and Iterate through - Exclude Hidden and Certain System lists
    $ExcludedLists = @("Form Templates", "Site Assets", "Style Library", "Site Pages", "Preservation Hold Library")
    $Lists =  Get-PnPList | Where {$_.Hidden -eq $False -and $_.Title -notin $ExcludedLists}
    ForEach($List in $Lists)
    {
        #Get List Experience
        $Global:ListExperience += New-Object PSObject -Property ([Ordered]@{
            'SiteURL' = $Web.URL
            'List Title' = $List.Title
            'URL' = $List.DefaultViewUrl
            'List Experience' = $List.ListExperienceOptions
        })
    }
}

#Parameters
$SiteURL ="https://crescent.sharepoint.com/sites/operations"
$CSVPath = "C:\Temp\ListExperience.csv"
$Global:ListExperience = @()
   
#Connect to PnP Online
Connect-PnPOnline -URL $SiteURL -Interactive

#Get All Webs in the site collection and Iterate through
$Webs = Get-PnPSubWeb -Recurse -IncludeRootWeb
ForEach($Web in $Webs)
{ 
    Get-PnPListExperience -Web $Web
}
#Export Data to CSV file
$Global:ListExperience | Sort-Object SiteURL
$Global:ListExperience | Sort-Object SiteURL | Export-csv -Path $CSVPath -NoTypeInformation

Report output:

powershell to get sharepoint online list experience

Conclusion

In summary, getting the list experience settings in SharePoint Online allows you to determine whether a list uses the new or classic experience. By using the SharePoint Online UI, you can navigate to the list settings, then click on “Advanced settings”, then you can find the “List Experience” settings there. Additionally, you can also use the PowerShell scripts to retrieve the list experience settings for a specific list or all lists on a site.

Here is my other post to set a list to modern experience: SharePoint Online: Change List Experience using PowerShell

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

One thought on “SharePoint Online: Get List Experience Settings using PowerShell

  • Is it possible to fix this to be compliant with modern authentication?

    Reply

Leave a Reply

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