SharePoint 2010 Cookbook: How to Activate Features When Creating Custom Site Templates on Different Servers

SharePoint 2010 has many features that were unavailabe in SharePoint 2007.  Consequently, complications are occasionally encountered when working on the new platform. In this article, we will take a look at how to activate features while creating custom sites or site templates which are being imported from other farms.

Challenge:

If you want to create a site on SharePoint 2010, you can create many lists or activate many features on the current farm, or you can configure some actions on the site and then decide that you want save the site template for importation to another farm. For this reason, when you create a site template in other farms, you always see an error page when logging onto your site. To resolve these difficulties, I will demonstrate how to activate features on Command Prompt. The advantage of this method is that you need only enter some simple command lines without the use of any complex configurations.

Solution:

First, I will demonstrate how to create a site template from a different farm through SharePoint 2010.

Step 1: Go to Site Actions -> Site Settings -> Select the Solution hyperlink.

Step 2: Upload a site template with format *.wsp to the portal site.

Make sure that you Activate the Solution when creating it:

After closing the above window, make sure that you see the status of the new template listed as Activated.

Step 3: Go to Site Actions and click on the New Site menu:

Fill in the Title and URL for the new site in the form, and make sure that you selected the Custom tab with the uploaded template as shown:

At this point, you will see an error page. This is the problem which we need to resolve.

Step 4: Very simple; you should go the farm, right-click on the Command Prompt and select Run as administrator as pictured below:

You’ll see a black window appear.

Step 5: You must enter the path: “cd C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14BIN” into black window as pictured below:

Next, you must enter the command line using the following syntax into the Command Prompt window:

stsadm -o activatefeature -id <the guid> -url http://[name]

Explanation:

<the guid>: the Correlation ID which was shown on the error page:

http://[name]: the URL of the portal site which is showing the error.

After running the command line above, you should go back to the portal site to re-create the custom site template. If you still get the error page with the other Correlation ID, you must copy only that Correlation ID and enter the command line (using the syntax above) into the Command Prompt window. We will repeat these steps until you activate all features on your farm.

Step 6: When you have activated all of the desired features on your farm, you will have successfully created the custom site as shown below:

Notes:

At Bamboo, we use these methods to export and import in order to easily save site templates from one farm to other farms. In this series of articles, I will introduce some Bamboo products, such as List Simple Search, Discussion Board Plus, and Bamboo Rating, all of which have been uploaded to another farm.

Step 1: My source Site includes List Simple Search; Discussion Board Plus; Bamboo Rating

Step 2: Create custom site template:

While creating a custom site, you will see the error page:

Go to Command Prompt and enter the path:

Next, enter the URL with the syntax “stsadm -o activatefeature -id <the guid> -url http://[name]

Now, you have successfully created a site template, as expected.

See Also: