Introduction

In this article, you will learn how retrieve, enable or disable the site collection features (site scoped) programmatically using REST API on SharePoint 2013 / SharePoint online. There are different ways that we use to work with site collection features. We will see how we can use REST APIs to achieve the functionalities.

Steps Inolved

Get Active Site Collection Features and Properties (Site scope)
The operation will fetch all the active site collection features present on the site.

Get/Check Site Collection Feature Properties/Status (Site scope)

Here we will see how we can get the particular feature and check whether the site collection feature is active or not. You can identify whether the feature is activated at site scope or not.

Activate the site collection feature (Site scope)

In the above section, we have seen how we can check the status of the site collection feature. Here we will see how we can activate the feature which is already installed on the site.

Deactivate the site collection feature (Site scope)

In the above section, we have seen how we can activate the site collection feature. Here we will see how we can deactivate the feature.

Note - The above set of operations needs to be called to get it executed.

  1. $(document).ready(function(){
  2. GetSiteCollectionFeatures(); // Retrieves all the site collection features enabled (site scoped features)
  3. GetSiteCollectionFeatureByID(); // Retrieves the site collection feature by id enabled (site scoped features)
  4. EnableSiteCollectionFeature(); // Enables site collection feature (Site scoped feature)
  5. DisableSiteCollectionFeature(); // Disables site collection feature (Site scoped feature)
  6. });
Summary

Thus you have learned how to retrieve, activate or de-activate the site collection features (site scoped) using REST API on SharePoint 2013 / SharePoint online sites.