Get All Active Features in SharePoint using CSOM

The example in this topic show how to use CSOM to Get All Active Features in SharePoint

  • using Microsoft.SharePoint.Client;
  • using System.Linq;
  •  
  • using (ClientContext clientContext = new ClientContext("http://MyServer/sites/MySiteCollection"))
  • {
  • FeatureCollection oFeatureCollection = clientContext.Web.Features;
  •  
  • // Here two properties are loaded in context. (1) Feature Display Name and (2) Feature Definition ID
  • // Only Activated features at "Web" level will be retrieved over here
  • clientContext.Load(oFeatureCollection, fColl => fColl.Include(f => f.DisplayName, f => f.DefinitionId));
  •  
  • clientContext.ExecuteQuery();
  •  
  • foreach (Feature oFeature in oFeatureCollection)
  • {
  • Console.WriteLine("Feature Display Name: " + oFeature.DisplayName + " | Feature Definition ID: " + oFeature.DefinitionId);
  • }
  • }

Thank you for reading this article. This code was tested in SharePoint 2013


© 2019 Code SharePoint