Free Support Forum - aspose.com

How to access shared mailboxes via IGraphClient

I am using the IGraphClient to fetch emails which works fine using aspose-email-21.1.3-jdk16.jar.
However i did not find any way to specify the user / sharedmailbox i want to query. I always get the access token owners mails.

Is there a way to access a shared mailboxes mails with IGraphClient?

@fxhak,
Thank you for your request. You can specify a user for a shared mailbox as below:

graphClient.setResource(ResourceType.Users);
graphClient.setResourceId("mailbox");
graphClient.listMessages("mailfolder")
// back to the current mailbox
graphClient.setResource(ResourceType.Me);

More samples: msgraph-java.zip (5.2 KB)
To our regret, the documentation is not ready yet. It will be published later.

@Andrey_Potapov That is what I was looking for! Thank you for the fast reply.