load all channels for a team and also fetch the filesFolder

Marco Dissel 26 Reputation points
2021-08-17T11:55:31.417+00:00

It is possible to load all channels for a team and also fetch the filesFolder property for each channel in a single request?

https://graph.microsoft.com/v1.0/teams/<id>/channels?$expand=filesFolder

is returning:
The query specified in the URI is not valid. Query option 'Expand' is not allowed. To allow it, set the 'AllowedQueryOptions' property on EnableQueryAttribute or QueryValidationSettings

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,521 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,824 questions
{count} votes

2 answers

Sort by: Most helpful
  1. HarmeetSingh7172 4,811 Reputation points
    2022-02-28T13:59:11.46+00:00

    Hi @Marco Dissel

    To list channels for a team, you can use the below endpoint-

    GET /teams/{team-id}/channels  
    

    As per the documentation, expand query parameter is not supported for all the relationships and resources.
    You can use direct endpoint to get FilesFolder for a teams channel.

    GET /teams/{id}/channels/{id}/filesFolder  
    

    Please refer get FilesFolder to know more.

    Hope it helps.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have further questions about this answer, please click "Comment".

    0 comments No comments

  2. Marco Dissel 26 Reputation points
    2022-02-28T15:36:16.3+00:00

    Thanks, but I need to minimize the number of requests for performance reasons. Not for each channel a separate request to fetch the filesFolder.

    0 comments No comments