Tuesday, September 28, 2021

Graph API News: API to add members in bulk to a team reached GA

As an active consumer of Microsoft Graph endpoints in the solutions I manage, I’m always happy when beta endpoints reach general availability (GA). That happened again in the Microsoft Graph Teams APIs. The endpoint to add members in bulk to a team has officially reached GA šŸ„³ after being for almost nine months only available via beta.

This API allows developers to add multiple users within a single request to a specific team. Previously, developers had to make multiple single requests to add many users to a team which can be a slow process. Also, the error handling mechanism is for sure one additional advantage that this API offers. If a request fails to add one or more users to a team, you get an HTTP response that indicates the users that could and couldn’t be added. For example, if you try to add a user that doesn’t exist in your organization anymore, the HTTP response will contain a NotFound code for that specific user.

The following example shows a request to add members in bulk to a team:

POST https://graph.microsoft.com/v1.0/teams/b55bd212.../members/add
"values":[ { "@odata.type":"microsoft.graph.aadUserConversationMember", "roles":[ ], "user@odata.bind":"https://graph.microsoft.com/v1.0/users(9fa90cf1...')" }, { "@odata.type":"microsoft.graph.aadUserConversationMember", "roles":[ "owner" ], "user@odata.bind":"https://graph.microsoft.com/v1.0/users(5e07f5b3...')" } ] }

For more details on this API, check out the official documentation.

Thanks for reading,

No comments:

Post a Comment