我正在从CSOM Powershell获取列表项数,并且结果与SharePoint UI(网站内容页面)中显示的项数不匹配。
Function New-Context([String]$WebUrl) {
$context = New-Object Microsoft.SharePoint.Client.ClientContext($WebUrl)
$context.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
$context
}
Function Get-List([Microsoft.SharePoint.Client.ClientContext]$Context, [String]$ListTitle) {
$list = $context.Web.Lists.GetByTitle($ListTitle)
$context.Load($list)
$context.ExecuteQuery()
write-host $list.ItemCount
}
$context = New-Context -WebUrl "https://URL"
$list = Get-List -Context $context -ListTitle "Images"
预期结果:图片库中有50个项目 实际结果:图像库中有25个项目