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("admin@xxxx.onmicrosoft.com", "passwordxxx");
service.setCredentials(credentials);
service.setImpersonatedUserId(
new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "group-smtp@xxx.onmicrosoft.com"));
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