I'm working on an API and i want to get Files and Folders of a specific teams' channel. I've tried with Graph Explorer but could not find anything resource. I have also tried the official documentation Microsoft Graph API.
I have tried the following API in explorer but it does not give the desired results.
https://graph.microsoft.com/v1.0/teams/{teamId}/channels/{channelId}/filesFolder
It is highly possible that i might have overlooked the my required resource but can someone help me out in it. Thanks
CodePudding user response:
You are using the correct endpoint
GET https://graph.microsoft.com/v1.0/teams/{team_id}/channels/{channel_id}/filesFolder
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
driveItem
represents a file thenfile
property 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
driveItem
represents a folder thenfolder
property 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.