Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,445 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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()
.clientId(clientID)
.clientSecret(secretValue)
.tenantId(tenantId)
.httpClient(customHttpClientBuilder.build())
.build();
IAuthenticationProvider authProvider =
new TokenCredentialAuthProvider(
Arrays.asList("https://graph.microsoft.com/.default"), tokenCredential);
GraphServiceClient<Request> graphClient =
GraphServiceClient.builder().authenticationProvider(authProvider).buildClient();
String userEmail = "xyz.com";
MessageCollectionPage messages = graphClient.users(userEmail).messages().buildRequest().get();// Code breaks on this line