I'm struggling with weird issue, I'm trying to get the items from a list on a sharepoint Site, I made a very simple script for testing purpose:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$WebURL = "https://mysharepointsite.com"
$listName = "Users"
$list = (Get-SPWeb $WebURL).Lists.TryGetList($ListName)
$items = $list.GetItems()
Write-Host $items.Count
write-Host $list.ItemCount
So my list exist and it contains 27 items (I check that manually), the $items.count return a null value but $list.itemCount returns 27 If I tried with another list on the same site, everything works perfectly, any idea of what I'm doing wrong?
Thanks for your help