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("my-email@mail.com")
.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
You can specify the well-know name in byMailFolderId()
MailFolder result = graphClient.me().mailFolders().byMailFolderId("inbox").get();