简体   繁体   English

如何获取 MS Teams 的频道文件和文件夹

[英]How to get MS Teams' channel files and folders

I'm working on an API and i want to get Files and Folders of a specific teams' channel.我正在处理 API,我想获取特定团队频道的文件和文件夹。 I've tried with Graph Explorer but could not find anything resource.我试过使用 Graph Explorer 但找不到任何资源。 I have also tried the official documentation Microsoft Graph API .我也试过官方文档Microsoft Graph API

I have tried the following API in explorer but it does not give the desired results.我在资源管理器中尝试了以下 API 但它没有给出预期的结果。

https://graph.microsoft.com/v1.0/teams/{teamId}/channels/{channelId}/filesFolder 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谢谢

You are using the correct endpoint您使用的是正确的端点

GET https://graph.microsoft.com/v1.0/teams/{team_id}/channels/{channel_id}/filesFolder

returns metadata about driveItem .返回有关driveItem的元数据。

Use parentReference.driveId and id in the next API call to get folders and files在接下来的 API 调用中使用parentReference.driveIdid获取文件夹和文件

GET https://graph.microsoft.com/v1.0/drives/{drive_id}/items/{id}/children

It returns a collection of driveItems with unique id .它返回具有唯一iddriveItems集合。

  • If driveItem represents a file then file property is not null.如果driveItem表示文件,则file属性不是 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 then folder property is not null.如果driveItem表示文件夹,则folder属性不是 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.获取有关文件夹的更多详细信息或获取文件夹中的项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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