UI和CSOM输出中的列表项计数不匹配

时间:2019-01-25 06:47:56

标签: powershell sharepoint sharepoint-2013 csom

我正在从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个项目

0 个答案:

没有答案