다음을 통해 공유


SPFarm.GetPersistedFeatureDefinition method (Guid, Int32, Boolean)

Returns the [T:HYPERLINK"https://msdn2.microsoft.com/EN-US/library/ms472446"\t"_blank"Microsoft.SharePoint.Administration.SPFeatureDefinition] object for the given compatibilityLevel and featureId values. If the fallback parameter value is true and a match cannot be found for the given compatibilityLevel and featureId values, the method will attempt to return a [T:HYPERLINK"https://msdn2.microsoft.com/EN-US/library/ms472446"\t"_blank"Microsoft.SharePoint.Administration.SPFeatureDefinition] object with a lower compatibilityLevel value. If a corresponding [T:HYPERLINK"https://msdn2.microsoft.com/EN-US/library/ms472446"\t"_blank"Microsoft.SharePoint.Administration.SPFeatureDefinition] object cannot be found with the given featureId using either the given compatibilityLevel or an earlier (fallback) build version, a null reference (Nothing in Visual Basic) is returned.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Function GetPersistedFeatureDefinition ( _
    featureId As Guid, _
    compatibilityLevel As Integer, _
    fallback As Boolean _
) As SPFeatureDefinition
'Usage
Dim instance As SPFarm
Dim featureId As Guid
Dim compatibilityLevel As Integer
Dim fallback As Boolean
Dim returnValue As SPFeatureDefinition

returnValue = instance.GetPersistedFeatureDefinition(featureId, _
    compatibilityLevel, fallback)
public SPFeatureDefinition GetPersistedFeatureDefinition(
    Guid featureId,
    int compatibilityLevel,
    bool fallback
)

Parameters

  • compatibilityLevel
    Type: System.Int32

    An integer that represents the feature compatibility level (for example, 14 or 15).

  • fallback
    Type: System.Boolean

    A Boolean value that specifies whether to fall back on older compatibility levels if the feature is not found.

Return value

Type: Microsoft.SharePoint.Administration.SPFeatureDefinition
An [T:HYPERLINK"https://msdn2.microsoft.com/EN-US/library/ms472446"\t"_blank"Microsoft.SharePoint.Administration.SPFeatureDefinition] object that represents the object that is associated with the GUID and the given compatibility level (or earlier compatibility level if fallback is set to true).

Exceptions

Exception Condition
ArgumentOutOfRangeException

The specified compatibilityLevel value is either larger than the major build version or smaller than the minimum compatibility level for the given feature.

See also

Reference

SPFarm class

SPFarm members

GetPersistedFeatureDefinition overload

Microsoft.SharePoint.Administration namespace