Skip to content

Incorrect error when querying AdministrativeUnit membership #3156

Description

@ssteiner

Describe the bug

My application needs to verify that a created user has joined an administrative unit with dynamic membership rules. Since querying the member directly hits another bug I'm making a query on the membership collection instead with filter

var userFilter = $"id eq '{id}'";

So here's the query

var items = await graphServiceClient.Directory.AdministrativeUnits[unitId].Members.GetAsync(o => 
{
    o.QueryParameters.Filter = filter;
}).ConfigureAwait(false);

I'm making that request immediately after creating the user, so the dynamic membership hasn't been applied yet. So, I'm expecting an empty result. Instead I'm getting an exception:

Request_ResourceNotFound - Resource '510f02dc-ce75-49dc-a964-7259341d973d' does not exist or one of its queried reference-property objects are not present

There's but one problem... the Resource mentioned that's my administrative unit, not the memberId I'm looking for. Thus, the error is wrong. It should say 'Resource 'id'' does not exist or one of its queried reference-property objects are not present'

If I wait for a minute and run the same code again, it returns success and returns the member - so I know what I'm querying is correct.

Expected behavior

The error should say that the Resource 'id' (with the ID I'm querying) is not present, not the Id of the Admin Unit (which most definitely IS present)

How to reproduce

Create an admin unit with dynamic membership, and create a rule on the UPN. Then create a user with a UPN matching the rule you created.
Immediately after creating the new user, run the query as described above on the AdminUnit.. you'll get the error.

SDK Version

6.2.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```
</details>


### Configuration

Win 11 Pro x64
.NET SDK 10.0.302

### Other information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:waiting-for-triageAn issue that is yet to be reviewed or assignedtype:bugA broken experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions