SOLVED

MS Teams: can not fetch channel messages with Graph API using an application token

Brass Contributor

I have created a test application which is requesting adminconsent from a MS teams admin with the following scopes:

 

openid offline_access channelmessage.read.group channelmessage.read.all chat.read chat.readbasic chat.readwrite user.read.all channel.readbasic.all directory.read.all group.read.all groupmember.read.all organization.read.all people.read.all presence.read.all team.readbasic.all

I am using an application token to fetch ms teams organization data like users, channels, teams etc. I have managed to fetch with Graph API the user, channel, teams data of an organization,
but when I tried to fetch messages
with

https://graph.microsoft.com/v1.0/teams/team_id/channels/channel_id/messages

I am getting the following error:

{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"date": "2021-03-03T22:23:47",
"request-id": "a279044a-ab9e-4c18-af71-5a65ea7cee86",
"client-request-id": "a279044a-ab9e-4c18-af71-5a65ea7cee86"
}
}
}
4 Replies
best response confirmed by christosjubile (Brass Contributor)
Solution

Hi @christosjubile, the List Channel Messages is under Protected APIs in Microsoft TeamsBefore calling this API with application permissions, you must request access. To request access to these protected APIs, complete the following request form.

@christosjubile please let us know if your issue has been resolved.
We are waiting for our incorporation in order to fill the form then I will inform you!
Yes this solution is working so you can consider this question as solved but I want some extra help
Right now with this API I can get all messages both channel and chats my question is how can I get some information about the chat rooms and especially the member of a chat room
1 best response

Accepted Solutions
best response confirmed by christosjubile (Brass Contributor)
Solution

Hi @christosjubile, the List Channel Messages is under Protected APIs in Microsoft TeamsBefore calling this API with application permissions, you must request access. To request access to these protected APIs, complete the following request form.

View solution in original post