SPListItemCollection.Add method (String, SPFileSystemObjectType)
建立會使用指定的資料夾 URL 和物件型別,但需要SPListItem.Update方法,以實際將項目加入清單中的項目。
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'宣告
Public Function Add ( _
folderUrl As String, _
underlyingObjectType As SPFileSystemObjectType _
) As SPListItem
'用途
Dim instance As SPListItemCollection
Dim folderUrl As String
Dim underlyingObjectType As SPFileSystemObjectType
Dim returnValue As SPListItem
returnValue = instance.Add(folderUrl, _
underlyingObjectType)
public SPListItem Add(
string folderUrl,
SPFileSystemObjectType underlyingObjectType
)
參數
folderUrl
Type: System.String清單項目應該建立所在之資料夾的伺服器相對 URL。URL 應開始以正斜線。例如, /sites/mysite/subweb/Lists/mylist/myfolder。
underlyingObjectType
Type: Microsoft.SharePoint.SPFileSystemObjectType其中一個列舉值,指定新的清單項目將代表檔案系統物件的型別。唯一有效的類型為File和Folder。如果您傳遞另一個值,當您在SPListItem物件上呼叫Update方法時,會擲回例外狀況。
傳回值
Type: Microsoft.SharePoint.SPListItem
新的項目。