編輯

共用方式為


List teams

Namespace: microsoft.graph

List all teams in an organization.

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

HTTP request

GET /teams

Optional query parameters

This method supports the $filter, $select, $top, $skiptoken, and $count OData query parameters to help customize the response.

Request headers

Header Value
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Accept application/json

Request body

Don't supply a request body for this method.

Response

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

Note

Currently, this API call returns only the id, displayName, and description properties of a team. To get all properties, use the Get team operation.

Examples

Example 1: Get a list of teams

Request

Here's an example of the request.

GET https://graph.microsoft.com/v1.0/teams

Response

Here's an example of a response.

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

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

{
  "value": [
    {
      "id": "172b0cce-e65d-44ce-9a49-91d9f2e8493a",
      "displayName": "Contoso Team",
      "description": "This is a Contoso team, used to showcase the range of properties supported by this API"
    },
    {
      "id": "890972b0cce-e65d-44ce-9a49-568hhsd7n",
      "displayName": "Contoso General Team",
      "description": "This is a general Contoso team"
    },
    {
      "id": "98678abcce0-e65d-44ce-9a49-9980bj8kl0e",
      "displayName": "Contoso API Team",
      "description": "This is Contoso API team"
    }
  ]
}

Example 2: Use $filter and $top to get two teams with a display name that starts with 'A'

Request

Here's an example of the request.

GET https://graph.microsoft.com/v1.0/teams?$filter=startswith(displayName, 'A')&$top=2

Response

Here's an example of a response.

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

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

{
  "value": [
    {
      "id": "172b0cce-e65d-44ce-9a49-91d9f2e8493a",
      "displayName": "A Contoso Team",
      "description": "This is a Contoso team, used to showcase the range of properties supported by this API"
    },
    {
      "id": "890972b0cce-e65d-44ce-9a49-568hhsd7n",
      "displayName": "A Contoso Notification Team",
      "description": "This is a notification Contoso team"
    }
  ]
}

Example 3: Use $filter and $select to get id and description for team with displayName equals "A Contoso Team"

Request

Here's an example of the request.

GET https://graph.microsoft.com/v1.0/teams?$filter=displayName eq 'A Contoso Team'&$select=id,description

Response

Here's an example of a response.

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

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

{
  "value": [
    {
      "id": "172b0cce-e65d-44ce-9a49-91d9f2e8493a",
      "description": "This is a Contoso team, used to showcase the range of properties supported by this API"
    }
  ]
}