共用方式為


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
    專案項目的名稱。名稱應該是檔案系統易記的名稱。
  • projectItemType
    型別:System.String
    專案項目的型別。
  • skipAutoPackage
    型別:System.Boolean
    如果為 true,則專案系統不會自動加入專案項目的功能或封裝。

傳回值

型別:Microsoft.VisualStudio.SharePoint.ISharePointProjectItem
新專案項目的執行個體。

例外狀況

例外狀況 條件
ArgumentNullException

如果有任何引數是 nullNull 參照 (即 Visual Basic 中的 Nothing),就會發生。

ArgumentException

會發生於下列狀況:

  • 如果有任何參數是空字串。

  • 如果路徑不是有效的絕對路徑 (也就是說,不在專案根路徑之下)。

  • 如果具有所提供之名稱的 SharePoint 專案項目已經存在。

.NET Framework 安全性

請參閱

參考

ISharePointProjectItemCollection 介面

Add 多載

Microsoft.VisualStudio.SharePoint 命名空間