'Where can i find all files shared within a team in Microsoft Teams using the teams API?
Solution 1:[1]
You need to know team_id and channel_id
To list all teams in an organization you need to get a list of groups that have a resourceProvisioningOptions property that contains "Team".
Endpoint to list teams
GET https://graph.microsoft.com/v1.0/groups?$select=id,resourceProvisioningOptions
Endpoint to list team's channels (use id from previous query)
GET https://graph.microsoft.com/v1.0/teams/{team_id}/channels
Endpoint to get files and folders
GET https://graph.microsoft.com/v1.0/teams/{team_id}/channels/{channel_id}/filesFolder
The query above returns metadata about driveItem.
Use parentReference.driveId and id in the next API call to get folders and files
GET https://graph.microsoft.com/v1.0/drives/{drive_id}/items/{id}/children
It returns a collection of driveItems with unique id.
- If
driveItemrepresents a file thenfileproperty is not null.
For each item that represents the file you can call
GET https://graph.microsoft.com/v1.0/drives/{drive_id}/items/{item_id}
to get more details about the file.
- If
driveItemrepresents a folder thenfolderproperty is not null.
For each item that represents the folder you can call
GET https://graph.microsoft.com/v1.0/drives/{drive_id}/items/{item_id}
GET https://graph.microsoft.com/v1.0/drives/{drive_id}/items/{item_id}/children
to get more details about the folder or to get items inside the folder.
If you want to download the content then call
GET https://graph.microsoft.com/v1.0/drives/{drive_id}/items/{item_id}/content
Resources:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

