Monday, May 30, 2016

The method GetItems of the type List with Id "GUID" is blocked by the administrator on the server.

This error usually comes from Public facing share point site which have anonymous access. While Rest API with anonymous access try the get Items form the share point List and libraries. SharePoint throws this error.

Exception : Microsoft.Sharepoint.Client.ApiBlockedException

Message : The method GetItems of the type List with Id "GUID" is blocked by the administrator on the server.

I already have lot of Rest API calls on the same public facing sharepoint site to get items from List / Libraries but those are executing without any issues.

But i have one REST API call which is trying to execute the Caml Query via rest api to filter values from Managed Meta data property is throwing  this error.

While i login into the site and execute the same code it doesn't throws any error.

After reading about this issue on internet i found one powershell script which is to allow the Get Items for Anonymous access.

$webapp = Get-SPWebApplication "<Web Application URL>"
$webapp.ClientCallableSettings.AnonymousRestrictedTypes.Remove([microsoft.sharepoint.splist], "GetItems")
$webapp.Update()

You need to run this script for the public facing site. After executing this script my rest api call was able to fetch the items from Sharepoint Library without any error,




No comments:

Post a Comment