获取 Microsoft Graph 请求的明确架构信息

Get definite schema information for Microsoft Graph requests

我有一个 Office JavaScript 加载项。我们处理我们自己的许可工作流程。工作流程的一部分是使用 office-js-helpers 来处理 Microsoft 日志记录。用户使用 Microsoft 端点登录,我们收到一个 访问令牌 ,我们将其发送到 https://graph.microsoft.com/v1.0/me 以检索用户数据。一些用户是个人 Microsoft 用户,其他用户是组织的一部分。

最近,我注意到未提供 givenName 字段,这会导致摄取错误。我发现很难设计一个模式来处理来自 MS Graph 的用户数据,因为我没有看到任何可能响应 me 请求的模式信息。

谁能告诉我 MS 在哪里列出了它的 Graph 请求的明确架构?是否有此类信息的请求 URI?

底层对象架构可以通过指定 odata=fullmetadata JSON control level 来确定,如下所示:

Url: https://graph.microsoft.com/v1.0/me
Method: Get
Headers
   Accept: application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=false

其中 returns 包含对象的类型名称odata.type 注释),如果是 https://graph.microsoft.com/v1.0/me 端点,它是 #microsoft.graph.user

然后通过Microsoft Graph API metadata endpoint:

Url: https://graph.microsoft.com/v1.0/$metadata
Method: Get

其中 microsoft.graph.user 实体架构可以在 Schema 元素下找到 Namespace="microsoft.graph"

<EntityType Name="user" BaseType="microsoft.graph.directoryObject" OpenType="true">
    <Property Name="accountEnabled" Type="Edm.Boolean" />
    <Property Name="ageGroup" Type="Edm.String" />
    <Property Name="assignedLicenses" Type="Collection(microsoft.graph.assignedLicense)" Nullable="false" />
    <Property Name="assignedPlans" Type="Collection(microsoft.graph.assignedPlan)" Nullable="false" />
    <Property Name="businessPhones" Type="Collection(Edm.String)" Nullable="false" />
    <Property Name="city" Type="Edm.String" />
    <Property Name="companyName" Type="Edm.String" />
    <Property Name="consentProvidedForMinor" Type="Edm.String" />
    <Property Name="country" Type="Edm.String" />
    <Property Name="department" Type="Edm.String" />
    <Property Name="deviceKeys" Type="Collection(microsoft.graph.deviceKey)" Nullable="false" />
    <Property Name="displayName" Type="Edm.String" />
    <Property Name="employeeId" Type="Edm.String" />
    <Property Name="givenName" Type="Edm.String" />
    ...
  </EntityType>