kwizcom banner advertisement

SharePoint Online: Get List Settings using PowerShell

Requirement: Get SharePoint Online list settings using PowerShell

How to Get List Properties in SharePoint Online?
To get list properties such as List Title, Description, Versioning Settings, Require Checkout , etc you can head on to List setting page.
sharepoint online powershell get list properties

SharePoint Online: PowerShell to Get List Properties
You can get list properties of a SharePoint Online list using this PowerShell script.
#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"
   
#Config Parameters
$SiteURL= "https://crescent.sharepoint.com/"
$ListName="Projects"
 
#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
   
    #Get the List
    $List=$Ctx.Web.Lists.GetByTitle($ListName)
    $Ctx.Load($List)
    $Ctx.ExecuteQuery()
  
    #Get List Properties: Title, Description
    Write-host -f Yellow "---  General Settings ---"
    Write-host "List Title:" $List.Title
    Write-host "List Description:" $List.Description
    #Write-host "Show in Quick Launch:" $List.OnQuickLaunch

    Write-host -f Yellow "--- Versioning settings ---"
    Write-host "Content Approval Enabled:" $List.EnableModeration
    Write-host "Versioning Enabled:" $List.EnableVersioning
    Write-host "Major Versions Limit:" $List.MajorVersionLimit
    #Write-host "Minor Versions Enabled:" $List.EnableMinorVersions
    Write-host "Minor Versions Limit:" $List.MajorWithMinorVersionsLimit        
    Write-host "Draft Versions Security:" $List.DraftVersionVisibility
    Write-host "Require Checkout:" $List.ForceCheckout  #In Document Libraries

    Write-host -f Yellow "--- Advanced settings ---"
    Write-host "Content Type Enabled:"$List.ContentTypesEnabled
    Write-host "Attachments Enabled:"$List.EnableAttachments
    Write-host "New Folders Command Available:"$List.EnableFolderCreation
    Write-host "No Crawl Flag:"$List.NoCrawl
    #Write-host "Offline Availability:"$List.ExcludeFromOfflineClient
    Write-host "List Experience:"$List.ListExperienceOptions
    
    #Other hidden Settings
    Write-host -f Yellow "--- Other settings ---"
    Write-host "List ID:"$List.ID
    Write-host "List Created On:"$List.Created
    Write-host "List Item Count:"$List.ItemCount
    Write-host "Is Hidden List:"$List.Hidden
    Write-host "Document Template:"$List.DocumentTemplateUrl #In Document Libraries
    Write-host "List Type:"$List.BaseType   
    
}
Catch {
    write-host -f Red "Error Getting List Properties!" $_.Exception.Message
}
Please note, not all list properties can be retrieved or set through CSOM!
To get all methods and properties available for a List object, You can use SharePoint Online Client Browser or this PowerShell code: $List | Get-member
SharePoint Online: Get List Settings using PowerShell SharePoint Online: Get List Settings using PowerShell Reviewed by Salaudeen Rajack on July 28, 2017 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.