ISharePointProjectItemCollection.Add 方法 (String, String, String, Boolean)

创建一个 SharePoint 项目项,并将其添加到项目中。

命名空间:  Microsoft.VisualStudio.SharePoint
程序集:  Microsoft.VisualStudio.SharePoint(在 Microsoft.VisualStudio.SharePoint.dll 中)

语法

声明
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
)

参数

  • path
    类型:System.String
    项目项的基路径。可以是项目路径的相对路径,也可以是项目路径的绝对路径。
  • name
    类型:System.String
    项目项的名称。该名称应为文件系统友好名称。
  • skipAutoPackage
    类型:System.Boolean
    如果为 true,则项目系统不会自动为项目项添加功能或包。

返回值

类型:Microsoft.VisualStudio.SharePoint.ISharePointProjectItem
一个新项目项的实例。

异常

异常 条件
ArgumentNullException

如果这些参数中有 nullnull 引用(在 Visual Basic 中为 Nothing),就会出现这种情况。

ArgumentException

在下列情况下会出现这种情况:

  • 如果有任何参数为空字符串。

  • 如果该路径不是有效绝对路径(即不在项目的根路径下)。

  • 如果具有所提供名称的 SharePoint 项目项已存在。

.NET Framework 安全性

请参见

参考

ISharePointProjectItemCollection 接口

Add 重载

Microsoft.VisualStudio.SharePoint 命名空间