Microsoft.Graph.Models.ODataErrors.ODataError: Exception of type 'Microsoft.Graph.Models.ODataErrors.ODataError' was thrown.

Angelica 15 Reputation points
2023-07-12T13:29:16.1833333+00:00

Good afternoon Community,

I am having an issue when querying Graph API from a console app as it keeps giving me the following error when a very simple odata query is built:

Error trying to query ADD data Microsoft.Graph.Models.ODataErrors.ODataError: Exception of type 'Microsoft.Graph.Models.ODataErrors.ODataError' was thrown.
   at Microsoft.Kiota.Http.HttpClientLibrary.HttpClientRequestAdapter.ThrowIfFailedResponse(HttpResponseMessage response, Dictionary`2 errorMapping, Activity activityForAttributes)
   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)

The query works perfectly when I execute the console app locally on my laptop but now that I am migrating this little console app into an Azure virtual machine, then the communication to Graph API is generating the errors mentioned above.

I am running out of ideas, does anyone know what can I do here, please? Many thanks in advance.

Please see below the API permissions

User's image

Microsoft Security Microsoft Graph
{count} votes

6 answers

Sort by: Most helpful
  1. RupenAnjaria 0 Reputation points
    2023-08-30T13:05:23.98+00:00
    
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.