SPFeatureDefinitionCollection.Add Method (String, Guid, Boolean)

Adds the Feature definition with the specified manifest path and solution ID to the collection of Feature definitions, including a Boolean parameter that specifies whether to force reinstallation of the Feature definition.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
Public Function Add ( _
    relativePathToFeatureManifest As String, _
    solutionId As Guid, _
    force As Boolean _
) As SPFeatureDefinition
'Usage
Dim instance As SPFeatureDefinitionCollection
Dim relativePathToFeatureManifest As String
Dim solutionId As Guid
Dim force As Boolean
Dim returnValue As SPFeatureDefinition

returnValue = instance.Add(relativePathToFeatureManifest, _
    solutionId, force)
public SPFeatureDefinition Add(
    string relativePathToFeatureManifest,
    Guid solutionId,
    bool force
)

Parameters

  • relativePathToFeatureManifest
    Type: System.String

    A string that contains the relative path to the manifest for the Feature.

  • solutionId
    Type: System.Guid

    System.Guid that identifies the solution.

  • force
    Type: System.Boolean

    true to specify that reinstallation of the Feature definition be forced; otherwise, false.

Return Value

Type: Microsoft.SharePoint.Administration.SPFeatureDefinition
A Microsoft.SharePoint.Administration.SPFeatureDefinition object that represents the new Feature definition.

Remarks

Adding a Feature to the collection installs the Feature in the server farm, making it available for activation in its specified scope. Adding a Feature that has farm scope not only installs the Feature, but activates it within the farm.

Warning

Using the SPFeatureDefinition constructor to create a Feature definition object is not supported, it returns a NullReferenceException if you attempt to implement members of an object created through the constructor.

See Also

Reference

SPFeatureDefinitionCollection Class

SPFeatureDefinitionCollection Members

Add Overload

Microsoft.SharePoint.Administration Namespace