Thursday, September 21, 2017



SharePoint JSOM Anonymous Access Error: GetItems on list id xxxx-xxxx-xxxx-xxxx blocked by administrator
Recently I was developing a functionality in SharePoint 2013 which queries the pages libraries, fetch the metadata of every pages and and display them in a table.

Problem:
It was working fine when the user is logged in, but when I access the site as anonymous user, it gave me error "The method GetItems on List with id xxxx-xxxx-xxxx-xxxx is blocked by administrator".

Solution:
So, after a quick googling I found the solution, that there are some restrictions in client object model for anonymous users. These restrictions are called client callable settings in SharePoint. The solution is removing the function GetItems from AnonymousRestrictedTypes using PowerShell:

$web = Get-SPWebApplication -Identity "http://YourWebUrl"
$web.ClientCallableSettings.AnonymousRestrictedTypes.Remove( [Microsoft.SharePoint.SPList],"GetItems")
$web.Update()

If you want to restore this restriction in future then you can run following command:

$web = Get-SPWebApplication -Identity "http://YourWebUrl"
$web.ClientCallableSettings.AnonymousRestrictedTypes.Add( [Microsoft.SharePoint.SPList],"GetItems")
$web.Update()