【问题标题】:How do I move file from one Sharepoint folder to another in the Team Platform with the Microsoft Graph API如何使用 Microsoft Graph API 将文件从一个 Sharepoint 文件夹移动到 Team Platform 中的另一个文件夹
【发布时间】:2019-11-26 21:53:08
【问题描述】:

场景是有Team A和Team B。在创建Team B时,我们是否可以引用来自Team A的文件也属于Team B。

【问题讨论】:

  • 这几乎肯定会被关闭,但您应该能够使用 ... 溢出菜单中的移动选项。只需上几个级别即可查看您有权访问的所有团队。

标签: sharepoint microsoft-graph-api onedrive sharepoint-online microsoft-teams


【解决方案1】:

我发现 Microsoft graph 提供的 API 可以将文件和文档从一个团队的 SharePoint 站点复制到另一个团队的 Sharepoint 站点。

 POST /drives/{driveId}/items/{itemId}/copy
 POST /groups/{groupId}/drive/items/{itemId}/copy
 POST /me/drive/items/{item-id}/copy
 POST /sites/{siteId}/drive/items/{itemId}/copy
 POST /users/{userId}/drive/items/{itemId}/copy

我能够通过图形 api 成功地将文件从一个团队移动到另一个团队。我以为我必须通过 SharePoint pnp 和 all 才能移动文件。 Graph API 正在处理所有事情。

【讨论】:

  • 请求正文用了什么?我尝试了目标站点的根驱动器项 ID,但文件只是在其目标中重命名。
  • 你好 @GabrielSmoljár https://graph.microsoft.com/v1.0/groups/{groupId}/drive/items/root:/General/{fileName}:/content?@microsoft.graph.conflictBehavior=rename 这是我用来 POST 请求和 GET 请求的端点 "V1endpoint/drives/{DriveId}/root:/General:/children"
  • 好的,但是 POST 中的请求正文呢?
  • await HttpPost($"/sites/{siteID}/lists/{ListId}/drive/items/{ItemToCopyId}/copy", new SharePointListItem { ParentReference = new parentReference { driveId = DriveID, id = GeneralFolderId } }); 请把以上标记为答案。谢谢
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-09-08
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多