SharePoint 2010 CSOM : Field or property Site users does not exist
SharePoint 2010 CSOM : Field or property Site users does not exist
Issue
Recently we installed SharePoint Online Client SDK and worked it worked fine. But we are unable to query Site Users in SharePoint 2010 Very weird issue because we tried exploring the members and found SiteUsers and infact in ISE site users auto populated.
Error
Exception calling "ExecuteQuery" with "0" argument(s): "Field or property "SiteUsers" does not exist."
Code
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SharePoint.Client') | Out-Null [System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SharePoint.Client.UserProfiles') | Out-Null $site = 'http://domain.com/' #Get the Client Context and Bind the Site Collection $context = New-Object Microsoft.SharePoint.Client.ClientContext($site) $users = $context.Web.SiteUsers $context.Load($users) $context.ExecuteQuery() |
Background
SharePoint 2010 Client SDK doesn't have User Profile DLL. That is for sure! Indeed site users appears because the PowerShell code is loading Online client SDK.
Solution
Remove the Out-Null and check the Hive !
Refer this link - SharePoint 2010 has no SiteUsers as members in web class