403 Error When Adding Members to Team via Graph API
I am encountering a 403 permission error when attempting to add a member to a team using the Graph API. This issue started recently, even though it previously worked without any problems. The setup is identical to the one described in this discussion.
Any assistance in resolving this issue would be greatly appreciated.
Microsoft Teams
Microsoft Graph
Microsoft Teams Development
-
JimmyYang-MSFT 55,701 Reputation points • Microsoft Vendor
2025-01-09T01:33:03.87+00:00 Hi @Samee
Teams tag is mainly focused on the general issue of Microsoft Teams troubleshooting. According to your description, your question is related to Teams API development, so I will also add Teams development tag to your thread. Thanks for your understanding!
-
Meghana-MSFT 3,911 Reputation points • Microsoft Vendor
2025-01-09T07:23:11.25+00:00 Hi Samee - Could you please the request-id and timestamp details of a recent repro along with the API calls made. You can also share above details here or send at microsoftteamsdev@microsoft.com.
-
Samee 5 Reputation points
2025-01-09T10:54:06.7033333+00:00 Here is the request-id and timestamp details:
statusCode: 403, code: 'Forbidden', requestId: '4c2f5e2c-1153-4e56-9faf-3a794fe6a7a6', date: 2025-01-09T10:50:33.000Z, body: '{"code":"Forbidden","message":"You do not have permission to perform this operation.","innerError":{"code":"AccessDenied","message":"You do not have permission to perform this operation.","details":[],"date":"2025-01-09T10:50:33","request-id":"4c2f5e2c-1153-4e56-9faf-3a794fe6a7a6","client-request-id":"53ee320c-724c-d2e7-f18d-45df377415d6"}}', headers: Headers { 'transfer-encoding': 'chunked', 'content-type': 'application/json', 'content-encoding': 'gzip', vary: 'Accept-Encoding', 'strict-transport-security': 'max-age=31536000', 'request-id': '4c2f5e2c-1153-4e56-9faf-3a794fe6a7a6', 'client-request-id': '53ee320c-724c-d2e7-f18d-45df377415d6', 'x-ms-ags-diagnostic': '{"ServerInfo":{"DataCenter":"UK South","Slice":"E","Ring":"5","ScaleUnit":"005","RoleInstance":"LO2PEPF00004047"}}', date: 'Thu, 09 Jan 2025 10:50:33 GMT' }
Here is the API call made:
console.log("Adding user to team..."); const conversationMember = { "@odata.type": "#microsoft.graph.aadUserConversationMember", roles: ["member"], "user@odata.bind": `https://graph.microsoft.com/v1.0/users('${userId}')`, }; await graphClient.api(`/teams/${team.id}/members`).post(conversationMember);
I don't get this error when I create the office account, wait about 35 seconds and then add the member to the team. I never used to get this error before, only recently.
-
Samee 5 Reputation points
2025-01-09T12:50:22.3733333+00:00 Here is the request-id and timestamp details:
statusCode: 403, code: 'Forbidden', requestId: 'a8954d41-b934-43a3-b2d8-0a14416e6b07', date: 2025-01-09T12:48:26.000Z, body: '{"code":"Forbidden","message":"You do not have permission to perform this operation.","innerError":{"code":"AccessDenied","message":"You do not have permission to perform this operation.","details":[],"date":"2025-01-09T12:48:26","request-id":"a8954d41-b934-43a3-b2d8-0a14416e6b07","client-request-id":"fcb3895d-1968-ab3f-f44d-331f72d2b4df"}}', headers: Headers { 'transfer-encoding': 'chunked', 'content-type': 'application/json', 'content-encoding': 'gzip', vary: 'Accept-Encoding', 'strict-transport-security': 'max-age=31536000', 'request-id': 'a8954d41-b934-43a3-b2d8-0a14416e6b07', 'client-request-id': 'fcb3895d-1968-ab3f-f44d-331f72d2b4df', 'x-ms-ags-diagnostic': '{"ServerInfo":{"DataCenter":"UK South","Slice":"E","Ring":"5","ScaleUnit":"001","RoleInstance":"LN2PEPF000114DF"}}', date: 'Thu, 09 Jan 2025 12:48:26 GMT' }
Here is the API call:
console.log("Adding user to team..."); const conversationMember = { "@odata.type": "#microsoft.graph.aadUserConversationMember", roles: ["member"], "user@odata.bind": `https://graph.microsoft.com/v1.0/users('${userId}')`, }; await graphClient.api(`/teams/${team.id}/members`).post(conversationMember);
-
Meghana-MSFT 3,911 Reputation points • Microsoft Vendor
2025-01-10T13:05:40.72+00:00 Hi Samee - We raised a bug for this issue, we will keep you posted on the updates. Thank you.
-
Samee 5 Reputation points
2025-01-10T13:14:11.4366667+00:00 Thank you @Meghana-MSFT
-
Samee 5 Reputation points
2025-01-13T10:45:04.75+00:00 @Meghana-MSFT any updates?
Sign in to comment