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.
I want to list messages of custom folder, this method lists only pre-defined folders not custom ones graphClient.listMessages(GraphKnownFolders.SentItems).
If I pass folder name as string “graphClient.listMessages(“NewFolder”)” it is giving below error.
Exception in thread “main” class com.aspose.email.system.exceptions.FormatException: The string contains invalid characters.
And also want to know how to pass the pre-defined folder names as string to listMessages().
You need to use the listFolders() method to get the custom folder id:
// List Sub Folders
//GraphFolderInfoCollection folderInfoCol = client.listFolders(GraphKnownFolders.Inbox);
// List Root Folders
GraphFolderInfoCollection folderInfoCol = client.listFolders();
for (GraphFolderInfo folderInfo : folderInfoCol) {
// check display name and fetch messages
if (folderInfo.getDisplayName().equals("myFolder")) {
client.listMessages(folderInfo.getItemId());
}
}
I am facing one issue, I am trying to get inbox sub-folders list, but size is limiting to 10 only. Inbox has 23 folders but when I try to get the size using “folders.size();” method it is giving 10 only even though it has 23 sub-folders. Could you please help me in this.
@jashuvaprasannakumar.kotte
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): EMAILJAVA-35183
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.