Thanks for posting your question in the Microsoft Q&A forum.
As far as I know, you can use batch requests to retrieve data and reduce your request rate. The error you're encountering might be due to rate limitations.
using Microsoft.Graph;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
public static async Task<IList<Team>> GetTeamsWithChannels(GraphServiceClient graphClient)
{
var teams = new List<Team>();
var teamsRequest = await graphClient.Teams.Request().GetAsync();
teams.AddRange(teamsRequest.CurrentPage);
var batchRequestsList = new List<BatchRequestContent>();
foreach (var team in teams)
{
var channelsRequest = graphClient.Teams[team.Id].Channels.Request();
batchRequestsList.Add(new BatchRequestContent(channelsRequest));
}
var batchRequestsBody = new BatchRequestContent(batchRequestsList);
await graphClient.BatchRequest.Request().PostAsync(batchRequestsBody);
foreach (var batchResponse in batchRequestsBody.Responses)
{
if (batchResponse.Status == 200)
{
//...
}
}
return teams;
}
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful