I am encountering an error in the GraphAPI while fetching emails from inbox
The following code
GraphFolderInfo info = client.getFolder(GraphKnownFolders.Inbox);
System.out.println(info.getItemId());
GraphMessageInfoCollection messageInfoColl2 = client.listMessages(info.getItemId());
for (GraphMessageInfo messageInfo : messageInfoColl2) {
System.out.println(messageInfo.getSubject());
}
causes an
Exception in thread "main" AsposeBadServerResponceException: Server error [400] Operation failed.: 400/Bad Request
Details:
{
"error": {
"code": "BadRequest",
"message": "Resource not found for the segment 'AAAA.....='.",
"innerError": {
"date": "2021-04-14T10:38:43",
"request-id": "380......",
"client-request-id": "380....."
}
}
}
From our proxy, i see that it tries to call
/v1.0/users/xxx@zzzz.tld/mailFolders/inbox/AAMxxxxx…=/messages?..
So it looks like the api considers the inbox folder to be a subfolder of inbox when using the actual itemId of the inbox folder…
@fxhak,
Thank you for the issue description. I have logged the issue in our tracking system with ID EMAILJAVA-34859. Our development team will investigate it. I will inform you about any progress.
@fxhak,
Our development team is working on a solution to the issue. But now you can use GraphKnownFolders.Inbox enumeration value instead of client.getFolder method as below:
Thanks! For the info. Unfortunately, using this workaround is really complex as my app has seperate functions for listing folders and getting the messages of a folder…
Along the same lines
GraphFolderInfo info = client.getFolder(GraphKnownFolders.Inbox);
client.listFolders(info.getItemId())
causes the same error whereas
client.listFolders(GraphKnownFolders.Inbox);
Results in a
com.aspose.email.internal.hw.zb: JSONObject["value"] not found.
The url called seems to be /v1.0/users/x@y.z/mailFolders/inbox
so it looks to me like it misses the childFolders path
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.