Go back to index
How to install a Feature
Following code block explains how to programmatically install a Feature to the farm. You must give the (folder) name of the feature to be installed. The feature should be available in the features folder.
using System;
using SPTool.Library;
namespace SPTool.Test
{
class Program
{
static void Main(string[] args)
{
SPTFarm farm = new SPTFarm();
// Install the feature
SPTReturn returnObj = farm.InstallFeature("SPTool.Site.Config", false);
// Check the status of installing the feature
if (returnObj.State == SPTState.Success)
{
// Installing Feature Successful
}
else
{
// Installing Feature Failed
}
}
}
}
Go back to index