I am trying to access office 365 groups using ews java api using impersonation. I am getting error:
The SMTP address has no mailbox associated with it.
Code:
ExchangeCredentials credentials = new WebCredentials("[email protected]", "passwordxxx");
service.setCredentials(credentials);
service.setImpersonatedUserId(
new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "[email protected]"));
FolderView folderView = new FolderView(50);
FindFoldersResults findFolderResults = service.findFolders(WellKnownFolderName.MsgFolderRoot, folderView);
The aim is to get channel messages of the team associated with this group. According to this: link
The channel messages are stored in group's mailbox's Conversation History/Team Chat folder
If you want to access the messages in a Teams channel. You could use List Channel messages graph API