Monday 12 May 2014

Powershell Script to clear Blob Cache


Write-Host -ForegroundColor White ” – Enabling SP PowerShell cmdlets…”
If ((Get-PsSnapin |?{$_.Name -eq “Microsoft.SharePoint.PowerShell”})-eq $null)
{
$PSSnapin = Add-PsSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | Out-Null
}
$webAppall = Get-SPWebApplication
foreach ($_.URL in $webAppall) {
$webApp = Get-SPWebApplication $_.URL
[Microsoft.SharePoint.Publishing.PublishingCache]::FlushBlobCache($webApp)
Write-Host “Flushed the BLOB cache for:” $webApp
}


Feature: New to the WSSv3 Platform is a concept called Features.  These enable you to package chunks of functionality and allow this functionality to be turned on or off in a WSSv3 based site

Feature Stapler: Feature Stapling allows you to “staple” a Feature to a site definition without modifying it in any way.  This means you can add your feature to all sites created using that site definition

Feature Staplee: To create a staple you actually create another Feature that does the staple and called Feature Staplee.

Scenario:  You want to run some custom code whenever a site is created. (a typical use of the ExecuteURL property in V2)
Solution:  Build a Feature that has an Event Receiver defined on it; & have it catch the Feature activation event.  Run your custom code in there.  Then, use a Feature Staple to staple your Feature to the site definition