Wednesday, 5 September 2012

Retrieve existing base permission using powershell

Below script can be used to retrieve the existing Base Permission for the given permission level.
param(

[Parameter(Position=0, Mandatory=$true)]
[string]
$siteURL
)
$snapin = Get-PSSnapin
Where-Object { $_.Name -eq "Microsoft.SharePoint.Powershell" }
if ($snapin -eq $null) {
Add-PSSnapin "Microsoft.SharePoint.Powershell"
}

$site=Get-SPSite $siteURL
$web=$site.RootWeb
$permissionLevel=$web.RoleDefinitions["PermissionName"]
Write-Host $permissionLevel.BasePermissions
$web.Dispose()
$site.Dispose()

Query List/Document Library in Specific Folder

To query SharePoint List or Document Library in specific Folder “ FolderServerRelativeUrl ” as part of the CAML Query Code Snippet ...