列出团队

命名空间:microsoft.graph

重要

Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。

列出组织中的所有团队

权限

要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限

权限类型 权限(从最低特权到最高特权)
委派(工作或学校帐户) Team.ReadBasic.All,TeamSettings.Read.All,TeamSettings.ReadWrite.All
委派(个人 Microsoft 帐户) 不支持。
应用程序 Team.ReadBasic.All,TeamSettings.Read.All,TeamSettings.ReadWrite.All

HTTP 请求

GET /teams

可选的查询参数

此方法支持 $filter$select$top$skiptoken$count OData 查询参数 来帮助自定义响应。

请求标头

标头
Authorization Bearer {token}。必需。
接受 application/json

请求正文

请勿提供此方法的请求正文。

响应

如果成功,此方法在响应正文中返回200 OK响应代码和team对象集合。

备注

目前,此 API 调用仅返回 团队iddisplayName说明 属性。 若要获取所有属性,请使用获取团队操作。

示例

示例 1:获取团队列表

请求

下面展示了示例请求。

GET https://graph.microsoft.com/beta/teams

响应

响应示例如下所示。

注意: 为了提高可读性,可能缩短了此处显示的响应对象。

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"
    }
  ]
}

示例 2:使用 $filter 和 $top 获取两个显示名称以"A"开头的团队

请求

下面展示了示例请求。

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

响应

响应示例如下所示。

注意: 为了提高可读性,可能缩短了此处显示的响应对象。

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"
    },
  ]
}

示例 3:使用 $filter 和 $select 获取 displayName 等于"A Contoso Team"的团队 ID 和说明

请求

下面展示了示例请求。

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

响应

响应示例如下所示。

注意: 为了提高可读性,可能缩短了此处显示的响应对象。

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"
    }
  ]
}

另请参阅