如何找出Exchange组文件夹的ID

时间:2014-04-07 14:32:32

标签: java exchangewebservices ewsjavaapi

我成功地通过EWS Java API从我的Exchange收件箱文件夹中接收了电子邮件:

Folder inbox = Folder.bind(service, WellKnownFolderName.Inbox);
FindItemsResults<Item> findResults = service.findItems(inbox.getId(),view);
for(Item item : findResults.getItems())
{
    //Do something with the item as shown
    System.out.println(item.getSubject());
}

但是,我想阅读来自组合文件夹收件箱的电子邮件: enter image description here

注释:组文件夹是一个Exchange文件夹,许多员工都可以访问(德语:Ressourcenpostfach)

但我找不到文件夹ID或如何访问组文件夹的收件箱文件夹。

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

您需要设置邮箱:

ItemView iview = new ItemView(1);
Mailbox mb = new Mailbox();
mb.setAddress("mymailbox@mycompany.com");   
FolderId folderId = new FolderId(WellKnownFolderName.Inbox, mb);
FindItemsResults<Item> findResults = service.findItems(folderId, iview);