Getting Invalid status code 'TooManyRequests' while sending adaptive cards

Copper Contributor

Hi,

 

Am trying to send adaptive cards to multiple users through MS Teams with the help of C# application.

While sending cards to multiple users at the same time, am getting the error "Operation returned an invalid status code 'TooManyRequests'" as am using "Parallel.For" loop and await methods.

 

Am calling SendCard method multiple times. As it dont have any dependency, i have used Parallel thread and async/await methods.

 

Parallel.For(0, dataCount, new ParallelOptions { MaxDegreeOfParallelism = 38 }, async i =>
{
await SendCard(response, cloudTable, entities[i].PartitionKey, entities[i].RowKey, entities[i].ConversationId, entities[i].ServiceUrl, stringData, entities[i].MailId);
});

 

await connectorClient.Conversations.SendToConversationAsync(conversationId, (Activity)response);

 

Kindly help me on this.

1 Reply

@maheshkumargunasekaran  - 
Hello,
Please have a look at this Rate limiting in Microsoft Teams
To avoid getting TooManyRequests you must implement the backoff strategy.

Thanks,

Hunaid Hanfee

---------------------------------------------------------------------------------------

If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.