SPFeatureDefinitionCollection.Add Method (String, Guid)
Adds the Feature definition with the specified manifest path and solution ID to the collection of Feature definitions.
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 _
) As SPFeatureDefinition
'Usage
Dim instance As SPFeatureDefinitionCollection
Dim relativePathToFeatureManifest As String
Dim solutionId As Guid
Dim returnValue As SPFeatureDefinition
returnValue = instance.Add(relativePathToFeatureManifest, _
solutionId)
public SPFeatureDefinition Add(
string relativePathToFeatureManifest,
Guid solutionId
)
Parameters
relativePathToFeatureManifest
Type: System.StringA string that contains the relative path to the manifest for the Feature.
solutionId
Type: System.GuidSystem.Guid that identifies the solution.
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