Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
SP.Feature Class
Collapse the table of content
Expand the table of content

SP.Feature Class

SharePoint 2010

Last modified: June 24, 2010

Applies to: SharePoint Foundation 2010

Represents an activated feature.


The following example creates an input button on an application page that displays the identifiers of the current website’s active features.

<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<script type="text/ecmascript" language="ecmascript">

    var featureCollection;
    var oneFeature;

    var site;
    function runCode() {
        var clientContext = new SP.ClientContext();
        site = clientContext.get_web();


        featureCollection = site.get_features();

        clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));

    function onQuerySucceeded() {
        var listEnumerator = featureCollection.getEnumerator();
        var featureInfo = '';

        while (listEnumerator.moveNext()) {
            oneFeature = listEnumerator.get_current();
            featureInfo += 'Feature ID: ' + oneFeature.get_definitionId() + '\n';

    function onQueryFailed(sender, args) {

        alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());


    <input id="Button1" type="button" value="Run Code" onclick="runCode()" />

© 2015 Microsoft