RAhul Apte
RAhul Apte

Reputation: 223

Difference in user endpoints

In my Azure AD tenant, I have few users which I get using https://graph.microsoft.com/beta/users and I get Education users for a school using https://graph.microsoft.com/beta/education/schools/<id>/users or https://graph.microsoft.com/beta/education/users

What is the difference here and how do we differentiate them in the portal panel? Can we make a general user an education user under a specific school? I actually am not an admin on the portal.

Upvotes: 0

Views: 140

Answers (1)

Marc LaFleur
Marc LaFleur

Reputation: 33114

At the AAD level (which is what you're surfacing in the Azure Portal), there isn't a difference between the objects.

What is different is how the User resource is rendered. When you query Users via /education/users, you get some additional metadata. For example, if the User is a Student you will get the educationStudent properties. If they're a Teacher, you'll see the educationTeacher properties.

The educationUser resources also have additional navigation properties for educationClass and educationScool. For example, you can call v1.0/education/users/{id}/classes but not v1.0/users/{id}/classes because the standard User resource lacks the classes navigational property.

This same model carries over to other areas:

  • educationUser extends the user resource
  • educationClass extends the group resource
  • educationSchool extends the administrativeUnit resource

You can add an educationUser to an educationSchool like this:

POST https://graph.microsoft.com/v1.0/education/schools/{schoolId}/users/$ref
Content-type: application/json
{
  "@odata.id":"https://graph.microsoft.com/v1.0/education/users/{userId}"
}

As an aside, I strongly caution against using the /beta version. The Beta version can and will break from time to time. Breaking changes happen without warning and, as such, is simply not reliable enough to use in a production application.

Upvotes: 1

Related Questions