Monday, January 5, 2015

Sharepoint Client Object Model anonymously accessing list items

Recently i have faced issue that i have unable to retrieve list items anonymously in Sharepoint client side model.So i  found behaviour that  for anonymous users, using the Client Object Model, are blocked from using
  • GetItems and GetChanges on SPLists
  • GetChanges and GetSubwebsForCurrentUser on SPWebs
  • GetChanges on SPSites

but  the ClientCallableSettings value can be adjusted to allow anonymous user access to one or more of these methods.

Doing this with PowerShell:
$webapp = Get-SPWebApplication "http://sp10dev"
$webapp.ClientCallableSettings.AnonymousRestrictedTypes.Remove([microsoft.sharepoint.splist], "GetItems")
$webapp.Update()

Be sure to replace "http://sp10dev" with whatever url your target webapp has. After doing this, anonymous calls to GetItems will work for that web application. The changes are persisted in the SharePoint database, and last until you change the setting again, or recreate the web application.

0 comments:

Post a Comment