Anounymous access SharePoint 2010 list data using JavaScript client object model

Below is the PowerShell script to access the data of SharePoint list from webparts using JavaScript client object model Anonymously.

$webapp = Get-SPWebApplication "http://spsite"
$webapp.ClientCallableSettings.AnonymousRestrictedTypes.Remove([microsoft.sharepoint.splist], "GetItems")
$webapp.Update()

Note:

  • Just replace¬†http://spsite with your WebApplication url.
  • “GetItems” remain the same.
  • “AnonymousRestrictedTypes.Add for reversing the changes”