使用指定的文件名称列表中指定的文件夹中创建指定类型的列表项。
命名空间: Microsoft.SharePoint
程序集: Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)
语法
声明
Public Function AddItem ( _
folderUrl As String, _
underlyingObjectType As SPFileSystemObjectType, _
leafName As String _
) As SPListItem
用法
Dim instance As SPList
Dim folderUrl As String
Dim underlyingObjectType As SPFileSystemObjectType
Dim leafName As String
Dim returnValue As SPListItem
returnValue = instance.AddItem(folderUrl, _
underlyingObjectType, leafName)
public SPListItem AddItem(
string folderUrl,
SPFileSystemObjectType underlyingObjectType,
string leafName
)
参数
folderUrl
类型:System.String应在其中创建列表项的文件夹相对于服务器的 URL。URL 应以斜线 ;例如, /sites/mysite/subweb/Lists/mylist/myfolder。
underlyingObjectType
类型:Microsoft.SharePoint.SPFileSystemObjectType指定新列表项表示的文件系统对象类型的枚举值之一。
leafName
类型:System.String文件名,包括文件扩展名 ;例如, mydoc.doc。有关详细信息,请参阅Name属性。
返回值
类型:Microsoft.SharePoint.SPListItem
新的列表项。
异常
| 异常 | 条件 |
|---|---|
| ArgumentOutOfRangeException |
备注
向列表添加项,第一次调用AddItem方法使用指定的文件名指定文件夹中创建指定类型的列表项。若要分配特定项目的每个字段的值,然后使用返回的SPListItem对象上索引器。最后,在要将更改写入数据库的SPListItem对象上调用Update方法。
重要信息 |
|---|
新项目不会实际添加到列表直到对内容数据库保存通过调用SPListItem.Update方法。 |
重要信息