Site collection Feature Activation using CSOM Code.
public static void ActivateFeature(string webFullUrl, Guid featureId, bool force, FeatureDefinitionScope featdefScope)
{
try
{
using (var ctx = new ClientContext(webFullUrl))
{
var features = ctx.Site.Features;
ctx.Load(features);
ctx.ExecuteQuery();
features.Add(featureId, force, featdefScope);
ctx.ExecuteQuery();
}
Console.WriteLine("Feature Activated.");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message );
}
}
{
try
{
using (var ctx = new ClientContext(webFullUrl))
{
var features = ctx.Site.Features;
ctx.Load(features);
ctx.ExecuteQuery();
features.Add(featureId, force, featdefScope);
ctx.ExecuteQuery();
}
Console.WriteLine("Feature Activated.");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message );
}
}
Comments
Post a Comment