I am trying to access microsoft graph api to send message to a channel in a team. I am using this endpoint https://graph.microsoft.com/beta/teams/{team_id}/channels/{channel_id}/messages. getting 403 forbidden error

Simran Panjwani 20 Reputation points
2024-03-27T07:45:49.6366667+00:00

I am trying to access microsoft graph api to send message to a channel in a team. I am using this endpoint https://graph.microsoft.com/beta/teams/{team_id}/channels/{channel_id}/messages.

I have already granted all the API permissions in AAD. I have granted Teamwork.Migrate.All as a application permission in my AAD. User's image

however, i am getting this error

 "code": "Forbidden",
        "message": "Missing role permissions on the request. API requires one of 'Teamwork.Migrate.All'. Roles on the request ''.",

Microsoft Teams | Development
Microsoft Teams | Development

Building, integrating, or customizing apps and workflows within Microsoft Teams using developer tools and APIs

Microsoft Security | Microsoft Entra | Microsoft Entra ID
Microsoft Security | Microsoft Graph
Microsoft Teams | Microsoft Teams for business | Other

Answer accepted by question author
CarlZhao-MSFT 46,456 Reputation points
2024-03-27T08:37:31.9433333+00:00

Hi @Simran Panjwani

Application permissions are only supported for migration. If you are not importing third-party messages into a team channel that is in a migrated state, do not use application permissions but instead use delegated permissions. Note that don't forget to grant administrator consent after granting permissions to the calling app.

User's image

Hope this helps.

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

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.