Share via


ISharePointProjectItemCollection.Add Method (String, String, String, Boolean)

Creates and adds a SharePoint project item to the project.

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

Syntax

'Declaration
Function Add ( _
    path As String, _
    name As String, _
    projectItemType As String, _
    skipAutoPackage As Boolean _
) As ISharePointProjectItem
ISharePointProjectItem Add(
    string path,
    string name,
    string projectItemType,
    bool skipAutoPackage
)

Parameters

  • path
    Type: String

    The base path of the project item. Can be either relative to the project path or absolute.

  • name
    Type: String

    The name of the project item. The name should be file system-friendly.

  • projectItemType
    Type: String

    The type of the project item.

  • skipAutoPackage
    Type: Boolean

    If true, the project system will not automatically add a feature or package for the project item.

Return Value

Type: Microsoft.VisualStudio.SharePoint.ISharePointProjectItem
An instance of the new project item.

Exceptions

Exception Condition
ArgumentNullException

Occurs if any of the arguments are nulla null reference (Nothing in Visual Basic).

ArgumentException

Occurs in the following cases:

  • If any of the parameters are empty strings.

  • If the path is not a valid absolute path (that is, not under the project root path).

  • If a SharePoint project item with the provided name already exists.

.NET Framework Security

See Also

Reference

ISharePointProjectItemCollection Interface

Add Overload

Microsoft.VisualStudio.SharePoint Namespace