How To Enable The SharePoint Learning Kit Feature On All Sites In A Site Collection

Sometimes you want to be able to assign work from anywhere within your site collection. For the E-Learning Actions custom action to be added to a document library you need to enable the SharePoint Learning Kit feature on that site, so to enable it everywhere you need to enable the feature on all sites.

To do this in SharePoint 2010 all you need is a simple PowerShell script which iterates through all the sites and then enables the feature if it is not already enabled. The following script will do that for you. You will need to change the url value to reference your site collection, save in a .ps1 file and then run from the SharePoint 2010 Management Shell.

$url = "http://urlOfSiteCollection"
$site = Get-SPSite $url
$featureId = "00057002-c978-11da-ba52-00042350e42e"
$featureName = "SharePointLearningKit"
$site.Urlforeach ($web in $site.AllWebs)
{
    # Output the site url for debugging purposes
    $web.Url
    # Only enable if not already enabled
    if (!$web.Features[$featureId])
    {
        # Output debugging message
        "Enabling..."
        Enable-SPFeature $featureName -Url $web.Url
    }
}

You can also use this for other features, just by replacing the feature id and name with the appropriate values. To find these look in

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES

The feature name is the name of the folder in here and the id is in the feature.xml file in that folder.

Richard

I am Managing Director of SalamanderSoft Limited a company devoted to improving IT in education. I am also the project co-ordinator for the open source projects SharePoint Learning Kit and Microsoft Learning Gateway.

4 thoughts on “How To Enable The SharePoint Learning Kit Feature On All Sites In A Site Collection

  1. Hi Richard,
    I believe this is regarding Sharepoint learning kit which is available on Codeplex and where you are the lead contributor.
    Can you please let me know when SLK1.7 will be released.Any timelines.
    Regards
    Bhaskar

  2. Hi Richard,

    Thanks for the wonderful update I am using SLK dlls inside a sharepoint solution to customize. I am trying to create assignments from a custom page. I am able to do it sometime but sometime it continuously give me type cast error as below:

    “Unable to cast object of type ‘Microsoft.SharePointLearningKit.AnonymousSlkStore’ to type ‘Microsoft.SharePointLearningKit.AnonymousSlkStore’.”

    on the line m_slkStore = SlkStore.GetStore(SPWeb);

    Can you please give me any clue on what is the cause of this error.

    Thanks for your time
    Safiya

Leave a Reply

Your email address will not be published. Required fields are marked *