question

PrathameshT-6133 avatar image
0 Votes"
PrathameshT-6133 asked Sridevi-MSFT answered

Forbidden access for exporting group chats

I am using the following API to export the group chats.
https://graph.microsoft.com/beta/teams/{id}/channels/getAllMessages

I am getting the following response:
{'error': {'code': 'Forbidden',
'innerError': {'client-request-id': '59b79800-e6fe-47ab-b046-a934aea57628',
'date': '2021-04-06T11:55:55',
'request-id': '59b79800-e6fe-47ab-b046-a934aea57628'},
'message': 'Forbidden'}}

As a prerequisite I have filled a form for request access and the same has been approved.
Also, I have given the required permissions (User.Chat.All, Read.Chat.All) to the application as mentioned in this link.
https://docs.microsoft.com/en-us/microsoftteams/export-teams-content


Also I tried to export the users chats using following API and it works perfectly fine.
https://graph.microsoft.com/beta/users/{id}/chats/getAllMessages

office-teams-app-devmicrosoft-graph-teamwork
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

  • I believe you when you called the GetAllMessages API call, you provided the graph permission "ChannelMessage.Read.All"(application permission)?

1 Vote 1 ·

Hey, that worked. Thanks a lot!!

0 Votes 0 ·

Adding right tags/teams to assist

0 Votes 0 ·

1 Answer

Sridevi-MSFT avatar image
0 Votes"
Sridevi-MSFT answered

Posting the Answer for better knowledge
Copying from @Deva-MSFT comments.

The GetAllMessages API call to work please add "ChannelMessage.Read.All"(application permission).

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.