API Graph per ottenere tutte le proprietà AAD

Aug 25 2020

Esiste un'API Graph che può essere utilizzata per ottenere un elenco di tutte le proprietà supportate da AAD. Non ho bisogno che queste proprietà siano specifiche dell'utente. Tutto ciò di cui ho bisogno è il nome delle proprietà (ex - nome, cognome, numero di telefono ecc.). Non ho bisogno di codificare queste proprietà nel mio codice, voglio sapere se esiste un'API per ottenere il nome di tutte le proprietà. Ho solo dati relativi all'inquilino come ID inquilino.

Risposte

1 juunas Aug 25 2020 at 17:32

La cosa più vicina che potresti cercare sono probabilmente i metadati EDM disponibili qui:https://graph.microsoft.com/v1.0/$metadati .

È in XML, ma se lo analizzi e trovi l'elemento EntityType con Name="user"attributo, puoi vedere quali proprietà ha:

<EntityType Name="user" BaseType="graph.directoryObject" OpenType="true">
  <Property Name="accountEnabled" Type="Edm.Boolean"/>
  <Property Name="ageGroup" Type="Edm.String"/>
  <Property Name="assignedLicenses" Type="Collection(graph.assignedLicense)" Nullable="false"/>
  <Property Name="assignedPlans" Type="Collection(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="creationType" Type="Edm.String"/>
  <Property Name="department" Type="Edm.String"/>
  <Property Name="displayName" Type="Edm.String"/>
  <!-- Lot of other properties... -->
</EntityType>

I documenti OpenAPI sono disponibili anche in GitHub:https://github.com/microsoftgraph/microsoft-graph-openapi. Non sono disponibili tramite un URL come i metadati EDM, ma sembra che sia un piano futuro:

I nostri piani prevedono di esporre le descrizioni OpenAPI per Microsoft Graph come parte del servizio stesso