共用方式為


Feature Class

Represents an activated feature.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.Client.ClientObject
    Microsoft.SharePoint.Client.Feature

Namespace:  Microsoft.SharePoint.Client
Assemblies:   Microsoft.SharePoint.Client.Silverlight (in Microsoft.SharePoint.Client.Silverlight.dll);  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)

Syntax

'Declaration
<ScriptTypeAttribute("SP.Feature", ServerTypeId := "{4e46b28c-e27f-4964-a8d4-fc25658d86d1}")> _
Public Class Feature _
    Inherits ClientObject
'Usage
Dim instance As Feature
[ScriptTypeAttribute("SP.Feature", ServerTypeId = "{4e46b28c-e27f-4964-a8d4-fc25658d86d1}")]
public class Feature : ClientObject

Examples

This code example displays the identifiers of the current website’s active features.

using System;
using Microsoft.SharePoint.Client;

namespace Microsoft.SDK.SharePointFoundation.Samples
{
    class FeatureExample
    {
        static void Main()
        {

            string siteUrl = "http://MyServer/sites/MySiteCollection";

            ClientContext clientContext = new ClientContext(siteUrl);
            Web site = clientContext.Web;
            FeatureCollection collFeature = site.Features;

            clientContext.Load(collFeature);
            clientContext.ExecuteQuery();

            foreach (Feature oneFeature in collFeature)
               Console.WriteLine("Feature ID: {0}", oneFeature.DefinitionId);
        }

    }
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Feature Members

Microsoft.SharePoint.Client Namespace