| title | Add member to team |
|---|---|
| description | Add a new member to a team. |
| author | MSFTRickyCastaneda |
| ms.localizationpriority | high |
| ms.subservice | teams |
| doc_type | apiPageType |
| ms.date | 08/19/2024 |
Namespace: microsoft.graph
Add a new conversationMember to a team.
Note
- The roles property is empty by default for all members. This property only contains additional qualifiers when relevant; for example, if the member has
ownerprivileges, the roles property containsowneras one of the values. Similarly, if the member is a guest, the roles property containsguestas one of the values. A basic member shouldn't have any values specified in the roles property. - After adding a new conversation member to a team, it might take some time for the addition to be reflected. Users can use change notifications to subscribe to notifications for membership changes in a particular team.
[!INCLUDE national-cloud-support]
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
[!INCLUDE permissions-table]
Note
Using application permissions to add guest members to a team is not supported.
POST /teams/{team-id}/members| Name | Description |
|---|---|
| Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
| Content-Type | application/json. Required. |
In the request body, supply a JSON representation of the conversationMember object.
If successful, this method returns a 201 Created response code and a conversationMember object in the response body.
For best results, stagger calls with a 2-second buffer.
Note
The response code 404 Not Found is returned when you attempt to add a disabled/blocked user.
POST https://graph.microsoft.com/v1.0/teams/ee0f5ae2-8bc6-4ae5-8466-7daeebbfa062/members
Content-type: application/json
{
"@odata.type": "#microsoft.graph.aadUserConversationMember",
"roles": ["owner"],
"user@odata.bind": "https://graph.microsoft.com/v1.0/users('8b081ef6-4792-4def-b2c9-c363a1bf41d5')"
}[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.type": "#microsoft.graph.aadUserConversationMember",
"id": "ZWUwZjVhZTItOGJjNi00YWU1LTg0NjYtN2RhZWViYmZhMDYyIyM3Mzc2MWYwNi0yYWM5LTQ2OWMtOWYxMC0yNzlhOGNjMjY3Zjk=",
"roles": [
"owner"
],
"userId": "50dffbae-ad0f-428e-a86f-f53b0acfc641",
"displayName": "Cameron White",
"email": "CameronW@contoso.com"
}The following example shows how to add a member to a team using the user principal name.
Note
You can't use the user principal name (UPN) to add a guest user to a team.
The following example shows a request.
POST https://graph.microsoft.com/v1.0/teams/ee0f5ae2-8bc6-4ae5-8466-7daeebbfa062/members
Content-type: application/json
{
"@odata.type": "#microsoft.graph.aadUserConversationMember",
"roles": ["owner"],
"user@odata.bind": "https://graph.microsoft.com/v1.0/users('jacob@contoso.com')"
}[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
[!INCLUDE sample-code] [!INCLUDE sdk-documentation]
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.type": "#microsoft.graph.aadUserConversationMember",
"id": "ZWUwZjVhZTItOGJjNi00YWU1LTg0NjYtN2RhZWViYmZhMDYyIyM3Mzc2MWYwNi0yYWM5LTQ2OWMtOWYxMC0yNzlhOGNjMjY3Zjk=",
"roles": [
"owner"
],
"userId": "50dffbae-ad0f-428e-a86f-f53b0acfc641",
"displayName": "Jacob Hancock",
"email": "jacob@contoso.com"
}