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”
Advertisements

Get all lists in Site collection and child sites(one level)

Below listed is a PowerShell to retrieve all the lists in Root site collection and its child sites(at one level)

Add-PSSnapin Microsoft.Sharepoint.Powershell
$site = Get-SPSite “SiteURL”
$sitelists = foreach ($web in $site.AllWebs) {
foreach($list in $web.lists){ $list }}
$sitelists |select Title | Export-CSV C:\liststitles.csv
Remove-PsSnapin Microsoft.SharePoint.PowerShell