Ashish Agarwal
Ashish Agarwal

Reputation: 51

Graph API to get all AAD Properties

Is there a Graph API which can be used to get a list of all properties which AAD supports. I dont need these properties to be user specific. All I need is the name of the properties (ex - firstname, lastname, phoneNo etc).I dont need to hard code these properties in my code I want to know if there is any API to get all the properties name. I only have tenant related data like tenant Id.

Upvotes: 1

Views: 919

Answers (1)

juunas
juunas

Reputation: 58733

The closest thing that you might be looking for is probably the EDM metadata available here: https://graph.microsoft.com/v1.0/$metadata.

It's in XML, but if you parse it and find the EntityType element with Name="user" attribute, you can see what properties it has:

<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>

The OpenAPI documents are also available in GitHub: https://github.com/microsoftgraph/microsoft-graph-openapi. They aren't available through a URL like the EDM metadata, but seems that is future plan:

Our plans are to expose the OpenAPI descriptions for Microsoft Graph as part of the service itself

Upvotes: 1

Related Questions