I am getting this error. com.microsoft.graph.core.ClientException: Error executing the request.

Afzal Ghani 0 Reputation points

I am trying to access an email box with the help of Graph API. but the issue is without a proxy I can hit the request. On my local env, everything works fine when I run this without proxy. But when I add the proxy and then run it fails and gives the error com.microsoft.graph.core.ClientException: Error executing the request.

I am attaching my code which I use please help me.

ProxyOptions proxyOptions =
    new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));

NettyAsyncHttpClientBuilder customHttpClientBuilder =
    new NettyAsyncHttpClientBuilder().proxy(proxyOptions);//Authentication is not required for the proxy

TokenCredential tokenCredential =
    new ClientSecretCredentialBuilder()

IAuthenticationProvider authProvider =
    new TokenCredentialAuthProvider(
        Arrays.asList("https://graph.microsoft.com/.default"), tokenCredential);

GraphServiceClient<Request> graphClient =
String userEmail = "xyz.com";

MessageCollectionPage messages = graphClient.users(userEmail).messages().buildRequest().get();// Code breaks on this line

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,126 questions
0 comments No comments
{count} votes