列出团队

命名空间:microsoft.graph

列出组织中的所有团队。

此 API 可用于以下国家级云部署。

全局服务 美国政府 L4 美国政府 L5 (DOD) 由世纪互联运营的中国
✅ ✅ ✅ ✅

权限

为此 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和 $countOData 查询参数,以帮助自定义响应。

请求标头

标头 值
Authorization 持有者 {token}。 必填。 详细了解 身份验证和授权。
接受 application/json

请求正文

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

响应

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

注意

目前,此 API 调用返回 团队 对象的所有属性,但仅填充 id、 displayName、 description 和 visibility 属性。 所有其他属性作为 null返回。 若要获取所有填充的属性,请使用 获取团队 作。

示例

示例 1:获取团队列表

请求

以下示例显示了一个请求。

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

响应

以下示例显示了相应的响应。

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

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

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#teams",
  "value": [
    {
      "id": "172b0cce-e65d-44ce-9a49-91d9f2e8493a",
      "createdDateTime": null,
      "displayName": "Contoso Team",
      "description": "This is a Contoso team, used to showcase the range of properties supported by this API",
      "internalId": null,
      "classification": null,
      "specialization": null,
      "visibility": "public",
      "webUrl": null,
      "isArchived": null,
      "isMembershipLimitedToOwners": null,
      "memberSettings": null,
      "guestSettings": null,
      "messagingSettings": null,
      "funSettings": null,
      "discoverySettings": null,
      "tagSettings": null,
      "summary": null
    },
    {
      "id": "890972b0cce-e65d-44ce-9a49-568hhsd7n",
      "createdDateTime": null,
      "displayName": "Contoso General Team",
      "description": "This is a general Contoso team",
      "internalId": null,
      "classification": null,
      "specialization": null,
      "visibility": "private",
      "webUrl": null,
      "isArchived": null,
      "isMembershipLimitedToOwners": null,
      "memberSettings": null,
      "guestSettings": null,
      "messagingSettings": null,
      "funSettings": null,
      "discoverySettings": null,
      "tagSettings": null,
      "summary": null
    }
  ]
}

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

请求

以下示例显示了一个请求。

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

响应

以下示例显示了相应的响应。

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

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

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#teams",
  "value": [
    {
      "id": "172b0cce-e65d-44ce-9a49-91d9f2e8493a",
      "createdDateTime": null,
      "displayName": "A Contoso Team",
      "description": "This is a Contoso team, used to showcase the range of properties supported by this API",
      "internalId": null,
      "classification": null,
      "specialization": null,
      "visibility": "public",
      "webUrl": null,
      "isArchived": null,
      "isMembershipLimitedToOwners": null,
      "memberSettings": null,
      "guestSettings": null,
      "messagingSettings": null,
      "funSettings": null,
      "discoverySettings": null,
      "tagSettings": null,
      "summary": null
    },
    {
      "id": "890972b0cce-e65d-44ce-9a49-568hhsd7n",
      "createdDateTime": null,
      "displayName": "A Contoso Notification Team",
      "description": "This is a notification Contoso team",
      "internalId": null,
      "classification": null,
      "specialization": null,
      "visibility": "private",
      "webUrl": null,
      "isArchived": null,
      "isMembershipLimitedToOwners": null,
      "memberSettings": null,
      "guestSettings": null,
      "messagingSettings": null,
      "funSettings": null,
      "discoverySettings": null,
      "tagSettings": null,
      "summary": null
    }
  ]
}

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

请求

以下示例显示了一个请求。

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

响应

以下示例显示了相应的响应。

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

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

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#teams(id,description)",
  "value": [
    {
      "id": "172b0cce-e65d-44ce-9a49-91d9f2e8493a",
      "description": "This is a Contoso team, used to showcase the range of properties supported by this API"
    }
  ]
}