Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
是否可以使用graph API创建项目文档集?_Api_Sharepoint_Microsoft Graph Api_Onedrive_Document Set - Fatal编程技术网

是否可以使用graph API创建项目文档集?

是否可以使用graph API创建项目文档集?,api,sharepoint,microsoft-graph-api,onedrive,document-set,Api,Sharepoint,Microsoft Graph Api,Onedrive,Document Set,到目前为止,我还没有找到任何关于如何使用Graph API在Sharepoint环境中创建项目文档集的信息。我试过Sharepoint和OneDrive。Sharepoint API说明: "Files and folders should only be added to a DocumentLibrary via the OneDrive API" "Either 'folder' or 'file' must be provided, but not both." OneDrive A

到目前为止,我还没有找到任何关于如何使用Graph API在Sharepoint环境中创建项目文档集的信息。我试过Sharepoint和OneDrive。Sharepoint API说明:

"Files and folders should only be added to a DocumentLibrary via the OneDrive API"
"Either 'folder' or 'file' must be provided, but not both."
OneDrive API说明:

"Files and folders should only be added to a DocumentLibrary via the OneDrive API"
"Either 'folder' or 'file' must be provided, but not both."
从回答中可以看出,它似乎仅限于创建文件夹或文件的选项。这是正确的吗?有没有办法使用不同的API调用将文件夹变为文档集

我曾尝试将内容类型ID添加到不同的请求主体中,但每次都没有提供进一步的解决方案


希望这里有人知道一个可能的解决办法,可以帮助我。谢谢

我自己也一直在研究这件事,结果还是走进了同一堵墙。 不幸的是,目前还没有综合方法。 您可以使用它们将其组合到您自己的文档集

亲切问候,,
R Schouten

我今天处理了同样的问题。经过一些业务逻辑之后,我需要在文档库的根级别创建一个文档集

我是如何做到这一点的:

1-获取文档库的驱动器Id

GEThttps://graph.microsoft.com/v1.0/sites/${siteId}/lists/${listId}?$expand=drive

2-创建文件夹

GET https://graph.microsoft.com/v1.0/sites/${siteId}/drives/${library.drive.id}/items/${folder.id}?expand=sharepointids 
PATCH https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${listId}/items/${sharepointIds.listItemId}
POSThttps://graph.microsoft.com/v1.0/drives/${library.drive.id}/root/children

记住将主体设置为:

{
    "name": ${nameOfTheFolder},
    "folder": {},
}
3-获取文件夹的SharePoint项目id

GET https://graph.microsoft.com/v1.0/sites/${siteId}/drives/${library.drive.id}/items/${folder.id}?expand=sharepointids 
PATCH https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${listId}/items/${sharepointIds.listItemId}
4-更新文档库中的项目,使其更新为所需的文档集

GET https://graph.microsoft.com/v1.0/sites/${siteId}/drives/${library.drive.id}/items/${folder.id}?expand=sharepointids 
PATCH https://graph.microsoft.com/v1.0/sites/${siteId}/lists/${listId}/items/${sharepointIds.listItemId}
不要忘记将主体设置为:

{
  "contentType": {
    "id": "content-type-id-of-the-document-set"
  },
  "fields": {
    //whatever fields you want to set
  }
}
希望能有帮助