SPListItemCollection.Add method (String, SPFileSystemObjectType, String)
建立使用指定的資料夾 URL、 物件類型和分葉名稱,但需要SPListItem.Update方法,以實際將項目加入清單中的項目。
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
Public Function Add ( _
folderUrl As String, _
underlyingObjectType As SPFileSystemObjectType, _
leafName As String _
) As SPListItem
'用途
Dim instance As SPListItemCollection
Dim folderUrl As String
Dim underlyingObjectType As SPFileSystemObjectType
Dim leafName As String
Dim returnValue As SPListItem
returnValue = instance.Add(folderUrl, _
underlyingObjectType, leafName)
public SPListItem Add(
string folderUrl,
SPFileSystemObjectType underlyingObjectType,
string leafName
)
參數
folderUrl
Type: System.String伺服器相對 URL 的資料夾,開始以正斜線。例如, /sites/mysite/subweb/Lists/mylist/myfolder。
underlyingObjectType
Type: Microsoft.SharePoint.SPFileSystemObjectType列舉值,指出清單項目的基礎物件型別。只有File和Folder都是有效的型別。
leafName
Type: System.String檔案名稱,包括副檔名。例如, mydoc.doc。如需詳細資訊,請參閱Name屬性。
傳回值
Type: Microsoft.SharePoint.SPListItem
新的項目。