A java client library to access Exchange web services. The API works against Office 365 Exchange Online as well as on premises Exchange.
ErrorMeetingRequestIsOutOfDate
when I try to accept a meeting request via the java api...import java.net.URI;
import microsoft.exchange.webservices.data.core.ExchangeService;
import microsoft.exchange.webservices.data.core.enumeration.misc.ExchangeVersion;
import microsoft.exchange.webservices.data.credential.ExchangeCredentials;
import microsoft.exchange.webservices.data.credential.WebCredentials;
import microsoft.exchange.webservices.data.property.complex.availability.OofSettings;
public class GetOOO {
public static void main(String[] args)
{
try
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
service.setTraceEnabled(true);
service.setUrl(new URI("https://email.xxx.com/EWS/Exchange.asmx"));
ExchangeCredentials credentials = new WebCredentials("<<superUserId>>", "<<SuperUserPassword>>","XXX");
service.setCredentials(credentials);
OofSettings myOOFSettings = service.getUserOofSettings("<<emailId>>");
System.out.println(myOOFSettings.getState());
service.close();
}
catch (Exception e)
{
System.out.println(e.getMessage());
e.printStackTrace();
}
}
}
Hi guys. Can anyone help me with a question, please? I am playing around with EWS Java Api and currently I'm trying to understand one thing.
If I loop through some items in Sent Items folder, I won't see any Emails that have: getIsFromMe() == true or getIsSubmitted() == true.
As per docs:
getIsFromMe():
getIsSubmitted():
@retor I did that a while ago, but maybe it helps you.
Subscribe to pull events:
List folder = new ArrayList();
folder.add(new FolderId().getFolderIdFromWellKnownFolderName(WellKnownFolderName.Calendar));
PullSubscription subscription = ExchangeClient.getExchangeService().subscribeToPullNotifications(folder,5, /* timeOut: the subscription will end if the server is not polled within 5 minutes. */
null, /* watermark: null to start a new subscription. */
EventType.Created,
EventType.Modified,
EventType.Deleted);
LOG.info("Subscription successful Id: ! "+subscription.getId() + " - Watermark: ! "+subscription.getWaterMark());
LOG.info("Starting thread...");
new Thread(new RetrieveEvents(subscription)).start();
RetrieveEvents thread:
@Override
public void run() {
LOG.info("Thread started!");
try {
LOG.info("Sleeping...");
sleep (60000);
LOG.info("Awake! Let's check the events!");
// Wait a couple minutes, then poll the server for new events.
GetEventsResults events = subscription.getEvents();
if (events != null && events.getItemEvents() != null && events.getAllEvents().size() > 0) {
// Loop through all item-related events.
for (ItemEvent itemEvent : events.getItemEvents()) {
LOG.info("itemEvent id: " + itemEvent.getItemId());
}
}
else {
LOG.info("No result! :(");
}
}
catch (Exception e) {
LOG.error("Exception", e);
}
}
hello guys, im using push notification subscribe :
System.out.println("START MAIL EXCHANGE");
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);
service.setUrl(new URI("https://outlook.office365.com/EWS/Exchange.asmx"));
ExchangeCredentials credentials = new WebCredentials(username, passworrd, "outlook.office365.com");
service.setCredentials(credentials);
URI uri = new URI("http://localhost:8087/api/mail");
WellKnownFolderName wkFolder = WellKnownFolderName.Inbox;
FolderId folderId = new FolderId(wkFolder);
List<FolderId> folder = new ArrayList<FolderId>();
folder.add(folderId);
PushSubscription subscription = service.subscribeToPushNotifications(
folder, uri , 1, null,
EventType.NewMail, EventType.Created, EventType.Deleted, EventType.Modified, EventType.Moved);
/*IAsyncResult result = service.beginSubscribeToPushNotifications(null, null, folder, uri, 1, null, EventType.NewMail, EventType.Created, EventType.Deleted);
PushSubscription subscription1 = service.endSubscribeToPushNotifications(result);*/
System.out.println("END MAIL EXCHANGE");
} catch (Exception e) {
System.out.println("EXCEPTION MAIL EXCHANGE");
e.printStackTrace();
}
Then my Listener :
@PostMapping(value = "/mail", consumes = MediaType.TEXT_XML_VALUE)
@Timed
public void mailExchange(HttpServletRequest request, HttpServletResponse response){
log.debug("---------- MAIL_EXCHANGE_LISTERNER SUECCESS ----------");
}
hello guys Im new to the use of ews-java-API. when i try to get inbox folder i get this error.microsoft.exchange.webservices.data.core.exception.service.remote.ServiceRequestException: The request failed. An element node 'soap:Envelope' of the type START_ELEMENT was expected, but node '{http://schemas.xmlsoap.org/wsdl/}definitions' of type START_ELEMENT was found.
please help me