Saturday, 22 February 2014

List property bag content

function LoadSharePointPowerShellEnviroment
{
 write-host
 write-host "Setting up Powershell enviroment for Sharepoint" -foregroundcolor Magenta
 Add-PSSnapin "Microsoft.Sharepoint.PowerShell" -ErrorAction SilentlyContinue
 Write-host "Sharepoint PowerShell Snapin loaded." -foregroundcolor Green
}
Clear-Host
LoadSharePointPowerShellEnviroment
write-host


$url= 'https://collaboration-dev5.ioc-lab.local/sites/ApprovalsPortal'
$site = New-Object Microsoft.SharePoint.SPSite($url)
$rootWeb = $site.RootWeb

Write-Host -foregroundcolor Green "The current Site"$rootWeb

$properties = $rootWeb.AllProperties

$properties.Keys | % {write-host $_":" $properties[$_]}

if ($rootWeb -ne $null)
{
    $rootWeb.Dispose()

}
If ($site -ne $null)
{
    $site.Dispose();
}

Write-Host -foregroundcolor Green "Script has finished executing "