Tuesday, 27 March 2012

Activate Document Set Feature

What is a document set?
Remember Document sets are NOT available in SharePoint foundation.
Site Settings
    Site Collection Administration
        Site Collection Features

   











Once in the feature list hit the activate button for document sets.


function LoadSharePointPowerShellEnviroment
{
 write-host
 write-host "Setting up Powershell enviroment for Sharepoint" -foregroundcolor Blue
 Add-PSSnapin "Microsoft.Sharepoint.PowerShell" -ErrorAction SilentlyContinue
 Write-host "Sharepoint PowerShell Snapin loaded." -foregroundcolor Green
}
 
write-host
LoadSharePointPowerShellEnviroment
 
write-host
write-host "Activating the Document Set Feature" -foregroundcolor Blue
Enable-SPFeature -Identity DocumentSet -url "http://ssrap2"
write-host "Document Set Feature activated" -foregroundcolor Green

Make sure to sub in your site URL where it's highlighted in yellow.

or if you're really bad-ass activate it in your feature receiver

private Guid DocumentSetFeatureID = new Guid("3bae86a2-776d-499d-9db8-fa4cdc7884f8");
        
// Uncomment the method below to handle the event raised after a feature has been activated.
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
    using (SPSite site = properties.Feature.Parent as SPSite)
    {
        if (site.Features[DocumentSetFeatureID] == null)
        {
            site.Features.Add(DocumentSetFeatureID);
        }
    }
}