Microsoft-graph-docs: User not appearing

Created on 7 Nov 2019  Â·  7Comments  Â·  Source: microsoftgraph/microsoft-graph-docs

When I add a User to a School I get the following error:

{
  "error": {
    "code": "Request_BadRequest",
    "message": "A conflicting object with one or more of the specified property values is present in the directory.",
    "innerError": {
      "request-id": "d9878c9f-4788-4ef5-83d7-919297288acd",
      "date": "2019-11-07T18:26:42"
    }
  }
}

Appearently the user is already added but is not visible in sds.microsoft.com and in Azure. How can I check if all went right?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

edu

Most helpful comment

Thank you for the additional information. I suspect SDS is filtering out this user because on or more properties are either missing or have an invalid value assigned. I will take a look and see if I can find which property or properties might be causing this behavior.

All 7 comments

Thank you for reporting this. I have a couple of follow up questions:

  1. Was the User you're attempting to add to this School imported using School Data Sync?
  2. Is this only happening one User/School or are you seeing multiple examples of this issue?

One potential solution is to make sure you're requesting the Member.Read.Hidden scope. It is possible for Class (Group) or School (Administrative Unit) membership to be hidden. From the permissions documentation:

Membership in some Office 365 groups can be hidden. This means that only the members of the group can view its members. This feature can be used to help comply with regulations that require an organization to hide group membership from outsiders (for example, an Office 365 group that represents students enrolled in a class).

I added the user by using the Graph Api: 'Add education user'

$graph->createRequest("POST", "/education/users")

That's working well, in Azure I can see the user is created as a teacher. Is happens with all users.

I check your suggestions first.

In sds.microsoft.com the user is still not appearing. Also not able to find it with 'Member.Read.Hidden'...

UPDATE: If using the https://graph.microsoft.com/beta/education/schools/{school-id}/users request the users are returned... Online on sds.microsoft.com the list of teachers/students is empty.

"primaryRole": "teacher" is set.

Thank you for the additional information. I suspect SDS is filtering out this user because on or more properties are either missing or have an invalid value assigned. I will take a look and see if I can find which property or properties might be causing this behavior.

Thanks, do you have an api-response of a 100% correct user so I can also compare?

The SDS UI assumes it is only responsible for the data SDS is importing and therefore actively ignores non-SDS entities.

The reason SDS isn't showing your User is that SDS leverages additional schema extension (extension_fe2174665583431c953114ff7268b7b3_Education_ObjectType) to determine the the "Object Type". In most cases, the type gets set automatically based on the endpoint the object was created through (Schools = school, Classes = section).

The /education/users endpoint, however, behaves differently. The Education Graph APIs does not make any distinction between User subtypes. Rather, it surfaces this subtype via the primaryRole property. Within SDS, however, there are a number of subtypes that it expects to see:

  • Teacher
  • Student
  • Parent
  • Contact

In order to have Users show up correctly within the SDS UI, the primaryRole needs to be set to one of those values

Teacher Example:

PATCH /education/users/{id}
{
  "primaryRole": "Teacher"
}

Student Example:

PATCH /education/users/{id}
{
  "primaryRole": "Student"
}
Was this page helpful?
0 / 5 - 0 ratings