Tag: ewsjavaapi

使用Exchange Web服务Java API下载附件?

我正在编写一个Java应用程序来使用Exchange Web服务下载电子邮件。 我正在使用Microsoft的ewsjava API来执行此操作。 我可以获取电子邮件标题。 但是,我无法使用此API下载电子邮件附件。 以下是代码段。 FolderId folderId = new FolderId(WellKnownFolderName.Inbox, “mailbox@example.com”); findResults = service.findItems(folderId, view); for(Item item : findResults.getItems()) { if (item.getHasAttachments()) { AttachmentCollection attachmentsCol = item.getAttachments(); System.out.println(attachmentsCol.getCount()); // This is printing zero all the time. My message has one attachment. for (int i = 0; i < attachmentsCol.getCount(); i++) { FileAttachment attachment […]

Exchange Web服务Java APi + RESTful推送通知侦听器

我试图让我的听众使用ews java API,但我不能..我希望你能帮助我! 我已经完成了以下步骤: 1)连接到交换Web服务 ExchangeService newService = new ExchangeService(ExchangeVersion.Exchange2010_SP2); newService.setUrl(“https://myurl/ews/Exchange.asmx”); ExchangeCredentials credentials = new WebCredentials(“user”,”password”); newService.setCredentials(credentials); 2)然后订阅推送通知: @Override public PushSubscription subscribeToPushNotifications(){ URI callback = null; PushSubscription pushSubscription = null; try{ logger.info(“Subscribing to push notifications.. Endpoint Listener URI = ” + config.getNotificationListenerURI()); callback = new URI(config.getNotificationListenerURI()); pushSubscription = service.subscribeToPushNotifications( getFoldersForSubscription(), callback , 5, null, EventType.NewMail, […]