简体   繁体   中英

How to get/download the uploaded files form Microsoft team using java sdk with microsoft graph API

I have Microsoft account with some groups and uploaded few documents on it. I have authentication code to connect to MS team and call the Microsoft graph API in place and it is working fine I can access few of the Teams api like get list of groups. channels and user.

But my requirement is I want to download the uploaded file to any group or channel of the MS teams.

I am trying below API to access it

                      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();

what will be the {item-id} here how we get the id, any API for this? With help of these API I am unable to get the file uploaded on MS teams.

Please help me. I am looking for the java code to achieve this.

Thank you!!

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

gives you the list of driveitems. Each object has id which is noting but the itemid. Pick the id which you want to get the content for and use the same call as you said.

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

You can test your graph API calls in Graph Explore as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM