Showing posts with label Client Side Object Model. Show all posts
Showing posts with label Client Side Object Model. Show all posts

Thursday, August 3, 2017

Anonymous Access for Client Object Model in SharePoint

Have you ever faced this error failed Message: The method “GetItems” of the type “List” with ID {GUID} is blocked by administrator on the server.on public facing site ?

So apparently anonymous users, using the Client Object Model, are blocked from using

    GetItems and GetChanges on SPLists
    GetChanges and GetSubwebsForCurrentUser on SPWebs
    GetChanges on SPSites

The good news, however, is that 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://sp2013dev"
$webapp.ClientCallableSettings.AnonymousRestrictedTypes.Remove([microsoft.sharepoint.splist], "GetItems")
$webapp.Update()
Be sure to replace "http://sp2013dev" 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.

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.