Error: Microsoft.Graph.Models.ODataErrors.ODataError: Issuer is not set in the query. Issuer issuer, IssuerUserId: issuerUserId

Priya
Priya
1194 Points
33 Posts

I'm trying to filer user by email in ms graph api as:

 var users = await _graphClient.Users.GetAsync((requestConfiguration) =>
{
     requestConfiguration.QueryParameters.Filter = $"identities/any(i:i/issuerAssignedId eq '{WebUtility.UrlEncode(email)}')";                
     requestConfiguration.QueryParameters.Select = new string[] { "displayName", "givenName", "postalCode", "identities", "mail" };
})

But getting following error:

Error: Microsoft.Graph.Models.ODataErrors.ODataError: Issuer is not set in the query. Issuer issuer, IssuerUserId: issuerUserId
   at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.ThrowIfFailedResponseAsync(HttpResponseMessage response, Dictionary`2 errorMapping, Activity activityForAttributes, CancellationToken cancellationToken)
   at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory`1 factory, Dictionary`2 errorMapping, CancellationToken cancellationToken)
   at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.SendAsync[ModelType](RequestInformation requestInfo, ParsableFactory`1 factory, Dictionary`2 errorMapping, CancellationToken cancellationToken)
   at Microsoft.Graph.Users.UsersRequestBuilder.GetAsync(Action`1 requestConfiguration, CancellationToken cancellationToken)

Anyone has any solution?

Views: 139
Total Answered: 1
Total Marked As Answer: 1
Posted On: 10-Oct-2024 01:16

Share:   fb twitter linkedin
Answers
Smith
Smith
2890 Points
78 Posts
         

We need to set both issuerAssignedId  and issuer  as combination of both make unique identifier. You can try as:

 var users = await _graphClient.Users.GetAsync((requestConfiguration) =>
{
     requestConfiguration.QueryParameters.Filter = $"identities/any(i:i/issuerAssignedId eq '{email}' and i/issuer eq '{issuer}')";                
     requestConfiguration.QueryParameters.Select = new string[] { "displayName", "givenName", "postalCode", "identities", "mail" };
})
Posted On: 10-Oct-2024 04:50
thanks. works for me.
 - Priya  17-Oct-2024 21:43
 Log In to Chat