Previously with the V5 of the Microsoft Java SDK for MSGraph, to retrieve the inbox folder by it's "well known name", I was doing the following:
return graphClient.users("[email protected]")
.mailFolders("inbox") // hardcoded well know name in place of id
.messages()
.get();
But since the V6 update, I can't find anything in the help pages nor the SDK on how to achieve the same.
It looks like there is a class WellKnownFolderName
in the SDK but I can't figure out how to use it.
I tried some things like
var folderId = new FolderId(WellKnownFolderName.Inbox).getUniqueId();
var inboxFolder = graphClient.me().mailFolders().byMailFolderId(folderId).get();
But folderId id is null
Previously with the V5 of the Microsoft Java SDK for MSGraph, to retrieve the inbox folder by it's "well known name", I was doing the following:
return graphClient.users("[email protected]")
.mailFolders("inbox") // hardcoded well know name in place of id
.messages()
.get();
But since the V6 update, I can't find anything in the help pages nor the SDK on how to achieve the same.
It looks like there is a class WellKnownFolderName
in the SDK but I can't figure out how to use it.
I tried some things like
var folderId = new FolderId(WellKnownFolderName.Inbox).getUniqueId();
var inboxFolder = graphClient.me().mailFolders().byMailFolderId(folderId).get();
But folderId id is null
Share Improve this question asked Jan 18 at 10:20 DamianDamian 932 silver badges4 bronze badges1 Answer
Reset to default 1You can specify the well-know name in byMailFolderId()
MailFolder result = graphClient.me().mailFolders().byMailFolderId("inbox").get();