共用方式為


ISharePointProjectItemCollection.Add Method (String, String, String)

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Creates and adds a new instance of SharePoint project item.

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 _
) As ISharePointProjectItem
ISharePointProjectItem Add(
    string path,
    string name,
    string projectItemType
)

Parameters

  • path
    Type: System.String

    The subfolder in the project where the new SharePoint item is created.

  • name
    Type: System.String

    The name of SharePoint project item to be added.

  • projectItemType
    Type: System.String

    The type ID of the SharePoint project item to be added.

Return Value

Type: Microsoft.VisualStudio.SharePoint.ISharePointProjectItem
An instance of the SharePoint project item that was added.

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