列出用户使用情况Rights

命名空间:microsoft.graph

重要

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

检索给定用户的 usageRight 对象列表。

权限

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

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

HTTP 请求

GET /users/{userId}/usageRights

可选的查询参数

此 API 支持 $filter OData 查询参数。 支持以下$filter模式:

  • $filter = state eq 'value'
  • $filter = serviceIdentifier eq 'value'
  • $filter = state eq 'value' and serviceIdentifier eq 'value'
  • $filter = ( value1、value2")
  • $filter =serviceIdentifier in ('value1', 'value2')
  • $filter ( value1"、value2") 和 serviceIdentifier 中的 state ( value1"、"value2")

请求头

名称 说明
Authorization Bearer {token}。必需。
odata.maxpagesize 设置每个结果页的最大大小。 可选。

请求正文

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

响应

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

此外,如果响应中有更多的页面,@odata.nextLink。

示例

示例 1:获取用户的所有使用权限

请求

GET https://graph.microsoft.com/beta/users/{userId}/usageRights

响应

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

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

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#users('64952b80-51fd-4378-9ba5-589a840afb80')/usageRights",
  "@odata.nextLink": "https://graph.microsoft.com/beta/users/64952b80-51fd-4378-9ba5-589a840afb80/usageRights?$skiptoken=W4diD29cGKX1bX",
  "value": [
    {
      "id": "c2e034cb-3cbc-41be-a496-bfcd031e4cfc",
      "catalogId": "CFQ7TTC0KCRG:0001",
      "serviceIdentifier": "mscrm.f6d23ec7-255c-4bd8-8c99-dc041d5cb8b3.517f7ddd-df45-4f1c-83ec-a081a047f546",
      "state": "active"
    }
  ]
}

示例 2:获取具有特定服务标识符和状态的用户的使用权限

请求

GET https://graph.microsoft.com/beta/users/{userId}/usageRights?$filter=state in ('active', 'suspended') and serviceIdentifier in ('ABCD')

响应

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

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

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#users('64952b80-51fd-4378-9ba5-589a840afb80')/usageRights",
  "value": [
    {
      "id": "505261eb-b4ee-421c-8206-05529ae2c150",
      "catalogId": "CFQ7TTC0KCRG:0001",
      "serviceIdentifier": "ABCD",
      "state": "active"
    }
  ]
}