要点是ParentUniqueId
属性存储父容器ID,在List Item
的情况下容器总是文件夹。
实施例1:
假设为一个文档库的结构如下:
Documents (library)
|
Document.docx (document item with id = 1)
然后查询:
/_api/Web/Lists/getByTitle('Documents')/items(1)/FieldValuesAsText?$select=ParentUniqueId
将返回的SP.List.rootFolder
值。
注:返回的值对应于Folder.UniqueId
和不到List.Id
下面的查询演示了如何检索文档库RootFolder.UniqueId
:
/_api/Web/Lists/getByTitle('Documents')/rootfolder/UniqueId
或
/_api/Web/GetFolderByServerRelativeUrl('Shared Documents')/UniqueId
实施例2
假设为一个文档库的结构如下:
Documents (library)
|
Orders (folder)
|
Document.docx (document item with id = 2)
然后查询:
/_api/Web/Lists/getByTitle('Documents')/items(2)/FieldValuesAsText?$select=ParentUniqueId
将返回Orders
文件夹的Folder.UniqueId
值。
相应的查询检索Orders
文件夹UniqueId
属性:
/_api/Web/GetFolderByServerRelativeUrl('Shared Documents/Orders')/UniqueId
谢谢!在我的情况下,URL是>>> _api/Web/GetFolderByServerRelativeUrl('Documents')/ UniqueId – 2014-09-29 05:21:21