Go back to index
How to deactivate a web application feature
Following code block explains how to programmatically deactivate a web application scoped feature. You can either give the name or Guid of the feature to be activated.
using System;
using SPTool.Library;
namespace SPTool.Test
{
class Program
{
static void Main(string[] args)
{
SPTWebApplication webApplication = new SPTWebApplication("http://sptool/");
// Deactivate web application scoped feature
SPTReturn returnObj = webApplication.DeactivateFeature("SPTool.Site.Config", false);
// Deactivate web application scoped feature using Guid
//returnObj = webApplication.DeactivateFeature("3FEF8D22-F191-41b6-8F1D-5D50D15BD2A6", false);
// Check the status of Deactivating the feature
if (returnObj.State == SPTState.Success)
{
// Deactivating Feature Successful
}
else
{
// Deactivating Feature Failed
}
}
}
}
Go back to index