method GetItems on list id {guid} blocked by administrator

Recently I developed a tooltip functionality in SharePoint 2010 which queries the pages list, fetch the title & description and renders it as a <div> element.

Problem Description:

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 {guid} is blocked by administrator”.

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.

Solution:

I found solution on this blog. But I googled a bit more & found interesting details so sharing them. Thanks to the author of the blog.

In SharePoint 2010, MS has exposed an API through which we can restrict from accessing methods or properties through client object model. SP 2010 has a property “SPClientCallableSettings.AnonymousRestrictedTypes” which as per MSDN states “Gets the restricted type information for anonymous users. If a method or property is defined as a restricted type, that method or property cannot be accessed by anonymous users.”.

So, modifying this property to remove restriction on method “GetItems” on “SPList” would solve the problem. But, before doing this make sure this change won’t affect security of your website.

Now, you can use powershell command to fix the problem. Following is the powershell script. (Note: I have used the same powershell script as mentioned in that blog. Thanks to the author of the blog.)

Get web application instance

=> $webApplication = Get-SPWebApplication “<webapplication url>”

Remove the restriction

=> $webApplication.ClientCallableSettings.AnonymousRestrictedTypes.Remove([microsoft.sharepoint.splist], “GetItems”)

update the changes you made to the web application instance

=> $webApplication.Update()

Hope it helps.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s