SharePoint Online: Get List by Title using PowerShell
SharePoint Online: PowerShell to Get List by Title
Here is how to get a list by its title.
Here is how to get a list by its title.
#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://crescenttech.sharepoint.com" $ListName="Documents" #Setup Credentials to connect $Cred= Get-Credential $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.Username, $Cred.Password) #Setup the context $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $Ctx.Credentials = $Credentials #Get the List $List=$Ctx.Web.Lists.GetByTitle($ListName) $Ctx.load($List) $Ctx.ExecuteQuery() Write-host "Total Number of List Items:"$List.ItemCount
No comments:
Please Login and comment to get your questions answered!