แก้ไข

แชร์ผ่าน


List associatedTeamInfo

Namespace: microsoft.graph

Get the list of teams in Microsoft Teams that a user is associated with. Currently, a user can be associated with a team in two different ways:

  • A user can be a direct member of a team.
  • A user can be a member of a shared channel that is hosted inside a team.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

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.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) Team.ReadBasic.All TeamSettings.Read.All, TeamSettings.ReadWrite.All
Delegated (personal Microsoft account) Not supported. Not supported.
Application Team.ReadBasic.All TeamSettings.Read.All, TeamSettings.ReadWrite.All

Note: Currently, with user delegated permissions, this operation only works for the me user. With application permissions, it works for all users by specifying the specific user ID (me alias is not supported with application permissions).

HTTP request

GET /users/{user-id}/teamwork/associatedTeams

Optional query parameters

This method does not currently support the OData query parameters to customize the response.

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.

Request body

Don't supply a request body for this method.

Response

If successful, this method returns a 200 OK response code and a collection of associatedTeamInfo objects in the response body.

Note: This API also returns the host team of the shared channel that the user is a direct member of.

Examples

Request

The following example shows a request.

GET https://graph.microsoft.com/v1.0/me/teamwork/associatedTeams

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 200 OK
Content-Type: application/json

{
  "value": [
    {
      "@odata.type": "#microsoft.graph.associatedTeamInfo",
      "id": "b695c5a5-c5a5-b695-a5c5-95b6a5c595b6",
      "tenantId": "172b0cce-e65d-7hd4-9a49-91d9f2e8493a",
      "displayName": "Contoso Team"
    },
    {
      "@odata.type": "#microsoft.graph.associatedTeamInfo",
      "id": "b695c5a5-8934-b695-a5c5-95b6a5c595b6",
      "tenantId": "172b0cce-8961-7hd4-9a49-91d9f2e8493a",
      "displayName": "Fabrikam Team"
    }
  ]
}