I am trying to access Microsoft Graph API to search the list items present in tenant. I am having no problem when GET request is executed for users or groups.
When I post the request for search using HttpClient as described on MS site. I am getting below error.
Failed to call the web API: BadRequest Content: {"error":{"code":"System.Exception","message":"SearchRequest Invalid (Region is required when request with application permission.)\r\nRegion is required when request with application permission.","target":"","details":null,"warnings":null,"level":"Error","httpCode":400},"Instrumentation":{"TraceId":null}}
I tried with .Net core as well. same error. If i paste access code on HTML file, calling api for search using Ajax is working fine.
what code i am missing in my c# code.
CodePudding user response:
The reason should be this endpoint you use not support application permission.
Usually this error message is encountered, indicating that application permission is not supported, you can use delegated permissions.