Skip to content

How to find enabled Site Features #1368

Answered by jansenbe
Ofer-Gal asked this question in Q&A
Discussion options

You must be logged in to vote

Ensure the features are loaded (e.g. await context.Site.EnsurePropertiesAsync(p => p.Features);) and then verify if the feature you need was there:

// Was the communication site feature enabled?
var communicationSiteFeature = Guid.Parse("f39dad74-ea79-46ef-9ef7-fe2370754f6f");
var feature = context.Site.Features.AsRequested().FirstOrDefault(p => p.DefinitionId == communicationSiteFeature);
bool enabled = feature != null;

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Ofer-Gal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants