SharePoint Online: Get List from PowerShell
Here is the PowerShell to Get SharePoint Online List
Related Post: SharePoint Online PowerShell to Get All Lists
Here is the PowerShell to Get SharePoint Online List
Import-Module Microsoft.Online.SharePoint.Powershell -DisableNameCheckingThis script gets the given list and number of items from the list.
#Config Variables for Site URL, List Name
$SiteURL= "https://crescent.sharepoint.com/sites/sales/"
$ListName="Sales Contacts"
#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
#powershell sharepoint online get list
$List = $Ctx.Web.Lists.GetByTitle($ListName)
$Ctx.Load($List)
$Ctx.ExecuteQuery()
Write-host "Total Number of Items in the List:"$List.ItemCount
}
Catch [Exception] {
Write-host $_.Exception.Message -f Red
}
Related Post: SharePoint Online PowerShell to Get All Lists