I am attempting to query a list using CAML via JSOM and am getting the error message The method "GetItems" of the type "List" with id "{GUID}" is blocked by the administrator on the server.
I have set the web application for anonymous, the site for anonymous use, and have checked that anonymous users have View
permissions on the list, but I continue to get this error message. I have verified my CAML is correct because I get the correct return values when running under an authenticated user. I have come across some sources that say to toggle off Require Use Remote Interfaces Permission, but that didn't resolve my problem either. Any suggestions?
-
1Did you add permission for the levels "Use Client Integration Features" and "Remote Interfaces"?– eirikbFeb 12, 2015 at 9:36
-
No, where might I find those settings? In CA?– KidBatmanFeb 13, 2015 at 6:14
-
Site settings -> Site permission -> Permission levels– eirikbFeb 13, 2015 at 7:53
-
Created a site permission level with the levels you suggested, but how do I assign them to Anonymous User? Looks like permissions for anon are restricted to a checkbox of CRUD actions.– KidBatmanFeb 13, 2015 at 8:50
2 Answers
In On Premise environment, we can disable the “Require Use Remote Interfaces permission” to let anonymous users access Client Object Model in Central Administration.
If it is an Online environment, you can use SP.Site.updateClientObjectModelUseRemoteAPIsPermissionSetting
Method to do the trick.
<script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(function() {
var ctx = new SP.ClientContext();
var site = ctx.get_site();
site.updateClientObjectModelUseRemoteAPIsPermissionSetting(false);
ctx.executeQueryAsync(
function() { alert('success') },
function() { alert('error') }
);
}, 'sp.js');
</script>
-
Just tried the suggested solution and receive
Access denied. You do not have permission to perform this action or access this resource.
from my callback fail method. Thoughts? Feb 13, 2015 at 6:20
I found a solution to my problem here. You have to remove the GetItems
function from the AnonymousRestrictedTypes
via powershell. Hope this helps others with this issue.