Enabling Content type level retention policy
When I was working on a small POC I got a requirement to archive a specific content type data. There are more content typed associated to that list. So I thought of implementing a custom retention policy to set expiration if the item content type is in giving archive list. Then I realized in future if similar content type associated to another list or library again I have to enable the same retention policy for that list or library. I thought that it was not a good approach. Then I found solution with in SP 2010 its by default provides content type level retention policy. Below is the approach.
1. Go to your application, Site Actions -> Site Settings.
2. Click on “Site Content types”
3. Click on content type on which you want to apply retention policy. You will see below screen
4. Click on “Information management policy settings” link.
5. Check “Enable Retention” then you will see below screen.
6. Click on “Add a retention stage…” link to add new policy.
7. Create your policy. You can set retention policy based on default stage activate rules provided by SharePoint 2010 or you can refer custom retention policy.
Similaryly you can have retention policies at folder level.
Reading Summary Links from a web part using power shell
Similar to other web parts, reading summary link web parts is always little tricky. We need to set current context before we tried to access. Below is the sample script to read all summary links from each page.
$pages = $web.Lists["Pages"];
foreach($page in $pages.Items)
if($page -eq $null)
if ($null -eq [System.Web.HttpContext]::Current)
$sw = New-Object System.IO.StringWriter
$resp = New-Object System.Web.HttpResponse $sw
$req = New-Object System.Web.HttpRequest “”, $web.Url, “”
$htc = New-Object System.Web.HttpContext $req, $resp
$htc.Items["HttpHandlerSPWeb"] = $web -as [Microsoft.SharePoint.SPweb]
[System.Web.HttpContext]::Current = $htc
$webPartCollection = $page.Web.GetWebPartCollection($page.Url,[Microsoft.SharePoint.WebPartPages.Storage]::Shared)
foreach($wp in $webPartCollection)
$webpart = $wp -as [Microsoft.SharePoint.WebPartPages.WebPart]
if ($webpart.GetType().Name -eq ‘SummaryLinkWebPart’)
Write-Output “Summary Links:”
$sumWP = $webpart -as [Microsoft.SharePoint.Publishing.WebControls.SummaryLinkWebPart]
foreach ($summarylink in $sumWP.SummaryLinkValue.SummaryLinks)