【问题标题】:How to get/download the uploaded files form Microsoft team using java sdk with microsoft graph API如何使用带有 microsoft graph API 的 java sdk 从 Microsoft 团队获取/下载上传的文件
【发布时间】:2021-02-17 11:23:05
【问题描述】:

我有一些群组的 Microsoft 帐户,并在上面上传了一些文档。 我有身份验证代码来连接到 MS 团队并就地调用 Microsoft 图形 API,它工作正常我可以访问一些团队 api,例如获取组列表。渠道和用户。

但我的要求是我想将上传的文件下载到MS团队的任何组或频道。

我正在尝试通过 API 访问它

                      graphClient.teams("acebf8ec-ea79-45f5-9570-b8e0bcdeeaba").channels(
                      "19%3afd70e03ba2c24cd7bffac753149dc620%40thread.tacv2").filesFolder().
                      buildRequest().get();  
            
  InputStream stream = graphClient.customRequest("/groups/{group-id}/drive/items/{item-id}/content", 
  InputStream.class) .buildRequest() .get();

这里的 {item-id} 是什么,我们如何获取 id,有任何 API 吗? 在这些 API 的帮助下,我无法将文件上传到 MS 团队。

请帮助我。 我正在寻找实现此目的的 java 代码。

谢谢!!

【问题讨论】:

  • https://graph.microsoft.com/v1.0/groups/{group-id}/drive/root/children 为您提供驱动项列表。每个对象都有id,这只是itemid。选择您想要获取内容的 id 并使用您上面所说的相同调用。
  • 我需要把 InputStream stream = graphClient.customRequest("/groups/{group-id}/drive/root/children", InputStream.class) .buildRequest() .get(); ?
  • 不确定代码,但您可以通过该调用获取驱动器项目列表。您还可以在Graph Explorer 中测试图形调用。
  • @ShivaKeshavVarma 是正确的。你不需要InputStream stream = graphClient.customRequest("/groups/{group-id}/drive/root/children", InputStream.class) .buildRequest() .get();。获取商品id后直接使用/groups/{group-id}/drive/items/{item-id}/content即可。
  • @ShivaKeshavVarma 您介意发布答案吗?

标签: sharepoint azure-active-directory microsoft-graph-api


【解决方案1】:

https://graph.microsoft.com/v1.0/groups/{group-id}/drive/root/children

为您提供驱动项列表。每个对象都有 id,但需要注意的是 itemid。选择您想要获取内容的 id 并使用与您所说的相同的调用。

/groups/{group-id}/drive/items/{item-id}/content

您也可以在 Graph Explore 中测试您的图形 API 调用。

【讨论】:

    猜你喜欢
    • 2018-06-16
    • 2020-10-08
    • 1970-01-01
    • 1970-01-01
    • 2022-01-15
    • 2020-05-10
    • 1970-01-01
    • 2020-09-16
    • 2019-02-27
    相关资源
    最近更新 更多