microsoft.exchange.webservices.data.core.ExchangeService Java Examples
The following examples show how to use
microsoft.exchange.webservices.data.core.ExchangeService.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Recurrence.java From ews-java-api with MIT License | 7 votes |
/** * Write property to XML. * * @param writer the writer * @throws Exception the exception */ @Override public void internalWritePropertiesToXml(EwsServiceXmlWriter writer) throws Exception { super.internalWritePropertiesToXml(writer); this.getDaysOfTheWeek().writeToXml(writer, XmlElementNames.DaysOfWeek); if (this.firstDayOfWeek != null) { EwsUtilities .validatePropertyVersion((ExchangeService) writer.getService(), ExchangeVersion.Exchange2010_SP1, "FirstDayOfWeek"); writer.writeElementValue( XmlNamespace.Types, XmlElementNames.FirstDayOfWeek, this.firstDayOfWeek); } }
Example #2
Source File: SubscribeRequest.java From ews-java-api with MIT License | 5 votes |
/** * Instantiates a new subscribe request. * * @param service the service * @throws Exception */ protected SubscribeRequest(ExchangeService service) throws Exception { super(service, ServiceErrorHandling.ThrowOnError); this.setFolderIds(new FolderIdWrapperList()); this.setEventTypes(new ArrayList<EventType>()); }
Example #3
Source File: ComplexPropertyDefinitionBase.java From ews-java-api with MIT License | 5 votes |
/** * Gets the property instance. * * @param propertyBag The property bag. * @param complexProperty The property instance. * @return True if the instance is newly created. */ private boolean getPropertyInstance( final PropertyBag propertyBag, final OutParam<ComplexProperty> complexProperty ) { final ServiceObject owner = propertyBag.getOwner(); final ExchangeService service = owner.getService(); if (!propertyBag.tryGetValue(this, complexProperty) || !hasFlag(PropertyDefinitionFlags.ReuseInstance, service.getRequestedServerVersion())) { complexProperty.setParam(createPropertyInstance(owner)); return true; } return false; }
Example #4
Source File: CreateFolderResponse.java From ews-java-api with MIT License | 5 votes |
/** * Gets the object instance. * * @param service The service. * @param xmlElementName Name of the XML element. * @return Folder * @throws Exception the exception */ private Folder getObjectInstance(ExchangeService service, String xmlElementName) throws Exception { if (this.folder != null) { return this.folder; } else { return EwsUtilities.createEwsObjectFromXmlElementName(Folder.class, service, xmlElementName); } }
Example #5
Source File: BaseTest.java From ews-java-api with MIT License | 5 votes |
/** * Setup Mocks * * @throws Exception */ @BeforeClass public static final void setUpBaseClass() throws Exception { // Mock up ExchangeServiceBase exchangeServiceBaseMock = new ExchangeServiceBase() { @Override protected void processHttpErrorResponse(HttpWebRequest httpWebResponse, Exception webException) throws Exception { throw webException; } }; exchangeServiceMock = new ExchangeService(); }
Example #6
Source File: GetItemResponse.java From ews-java-api with MIT License | 5 votes |
/** * Gets Item instance. * * @param service the service * @param xmlElementName the xml element name * @return Item * @throws Exception the exception */ private Item getObjectInstance(ExchangeService service, String xmlElementName) throws Exception { if (this.getItem() != null) { return this.getItem(); } else { return EwsUtilities.createEwsObjectFromXmlElementName(Item.class, service, xmlElementName); } }
Example #7
Source File: PhoneCall.java From ews-java-api with MIT License | 5 votes |
/** * PhoneCall Constructor. * * @param service the service */ public PhoneCall(ExchangeService service) { EwsUtilities.ewsAssert(service != null, "PhoneCall.ctor", "service is null"); this.service = service; this.state = PhoneCallState.Connecting; this.connectionFailureCause = ConnectionFailureCause.None; this.sipResponseText = PhoneCall.SuccessfullResponseText; this.sipResponseCode = PhoneCall.SuccessfullResponseCode; }
Example #8
Source File: FindConversationRequest.java From ews-java-api with MIT License | 4 votes |
/** * @throws Exception */ public FindConversationRequest(ExchangeService service) throws Exception { super(service); }
Example #9
Source File: ConsumeEWS.java From nifi with Apache License 2.0 | 4 votes |
/** * Fills the internal message queue if such queue is empty. This is due to * the fact that per single session there may be multiple messages retrieved * from the email server (see FETCH_SIZE). */ protected void fillMessageQueueIfNecessary(ProcessContext context) throws ProcessException { if (this.messageQueue.isEmpty()) { ExchangeService service = this.initializeIfNecessary(context); boolean deleteOnRead = context.getProperty(SHOULD_DELETE_MESSAGES).getValue().equals("true"); boolean markAsRead = context.getProperty(SHOULD_MARK_READ).getValue().equals("true"); String includeHeaders = context.getProperty(INCLUDE_EMAIL_HEADERS).getValue(); String excludeHeaders = context.getProperty(EXCLUDE_EMAIL_HEADERS).getValue(); List<String> includeHeadersList = null; List<String> excludeHeadersList = null; if (!StringUtils.isEmpty(includeHeaders)) { includeHeadersList = Arrays.asList(includeHeaders.split(",")); } if (!StringUtils.isEmpty(excludeHeaders)) { excludeHeadersList = Arrays.asList(excludeHeaders.split(",")); } try { //Get Folder Folder folder = getFolder(service); ItemView view = new ItemView(messageQueue.remainingCapacity()); view.getOrderBy().add(ItemSchema.DateTimeReceived, SortDirection.Ascending); SearchFilter sf = new SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false)); FindItemsResults<Item> findResults = service.findItems(folder.getId(), sf, view); if(findResults == null || findResults.getItems().size()== 0){ return; } service.loadPropertiesForItems(findResults, PropertySet.FirstClassProperties); for (Item item : findResults) { EmailMessage ewsMessage = (EmailMessage) item; messageQueue.add(parseMessage(ewsMessage,includeHeadersList,excludeHeadersList)); if(deleteOnRead){ ewsMessage.delete(DeleteMode.HardDelete); } else if(markAsRead){ ewsMessage.setIsRead(true); ewsMessage.update(ConflictResolutionMode.AlwaysOverwrite); } } service.close(); } catch (Exception e) { throw new ProcessException("Failed retrieving new messages from EWS.", e); } } }
Example #10
Source File: UpdateItemRequest.java From ews-java-api with MIT License | 4 votes |
@Override protected UpdateItemResponse createServiceResponse(ExchangeService service, int responseIndex) { return new UpdateItemResponse(this.getItems().get(responseIndex)); }
Example #11
Source File: SimpleServiceRequestBase.java From ews-java-api with MIT License | 4 votes |
/** * Initializes a new instance of the SimpleServiceRequestBase class. */ protected SimpleServiceRequestBase(ExchangeService service) throws Exception { super(service); }
Example #12
Source File: SubscribeToPullNotificationsRequest.java From ews-java-api with MIT License | 3 votes |
/** * Instantiates a new subscribe to pull notification request. * * @param service the service * @throws Exception the exception */ public SubscribeToPullNotificationsRequest(ExchangeService service) throws Exception { super(service); }
Example #13
Source File: MultiResponseServiceRequest.java From ews-java-api with MIT License | 3 votes |
/** * Initializes a new instance. * * @param service The service. * @param errorHandlingMode Indicates how errors should be handled. * @throws Exception */ protected MultiResponseServiceRequest(ExchangeService service, ServiceErrorHandling errorHandlingMode) throws Exception { super(service); this.errorHandlingMode = errorHandlingMode; }
Example #14
Source File: EmailMessage.java From ews-java-api with MIT License | 2 votes |
/** * Initializes an unsaved local instance of EmailMessage. To bind to an * existing e-mail message, use EmailMessage.Bind() instead. * * @param service The ExchangeService object to which the e-mail message will be * bound. * @throws Exception the exception */ public EmailMessage(ExchangeService service) throws Exception { super(service); }
Example #15
Source File: Folder.java From ews-java-api with MIT License | 2 votes |
/** * Binds to an existing folder, whatever its actual type is, and loads the * specified set of property. Calling this method results in a call to * EWS. * * @param service , The service to use to bind to the folder. * @param id , The Id of the folder to bind to. * @return A Folder instance representing the folder corresponding to the * specified Id. * @throws Exception the exception */ public static Folder bind(ExchangeService service, FolderId id) throws Exception { return Folder.bind(service, id, PropertySet.getFirstClassProperties()); }
Example #16
Source File: MeetingMessage.java From ews-java-api with MIT License | 2 votes |
/** * Binds to an existing meeting message and loads the specified set of * property. Calling this method results in a call to EWS. * * @param service The service to use to bind to the meeting message. * @param id The Id of the meeting message to bind to. * @param propertySet The set of property to load. * @return A MeetingMessage instance representing the meeting message * corresponding to the specified Id. * @throws Exception the exception */ public static MeetingMessage bind(ExchangeService service, ItemId id, PropertySet propertySet) throws Exception { return (MeetingMessage) service.bindToItem(id, propertySet); }
Example #17
Source File: CreateFolderResponse.java From ews-java-api with MIT License | 2 votes |
/** * Gets the object instance delegate. * * @param service the service * @param xmlElementName the xml element name * @return the object instance delegate * @throws Exception the exception */ @Override public ServiceObject getObjectInstanceDelegate(ExchangeService service, String xmlElementName) throws Exception { return this.getObjectInstance(service, xmlElementName); }
Example #18
Source File: SyncFolderHierarchyRequest.java From ews-java-api with MIT License | 2 votes |
/** * Creates the service response. * * @param service the service * @param responseIndex the response index * @return Service response. */ @Override protected SyncFolderHierarchyResponse createServiceResponse( ExchangeService service, int responseIndex) { return new SyncFolderHierarchyResponse(this.getPropertySet()); }
Example #19
Source File: Appointment.java From ews-java-api with MIT License | 2 votes |
/** * Binds to an existing appointment and loads its first class property. * Calling this method results in a call to EWS. * * @param service the service * @param id the id * @return An Appointment instance representing the appointment * corresponding to the specified Id. * @throws Exception the exception */ public static Appointment bind(ExchangeService service, ItemId id) throws Exception { return Appointment.bind(service, id, PropertySet.FirstClassProperties); }
Example #20
Source File: UpdateFolderRequest.java From ews-java-api with MIT License | 2 votes |
/** * Creates the service response. * * @param session The session * @param responseIndex Index of the response. * @return Service response. */ @Override protected ServiceResponse createServiceResponse(ExchangeService session, int responseIndex) { return new UpdateFolderResponse(this.getFolders().get(responseIndex)); }
Example #21
Source File: SyncFolderHierarchyRequest.java From ews-java-api with MIT License | 2 votes |
/** * Initializes a new instance of the class. * * @param service the service * @throws Exception */ public SyncFolderHierarchyRequest(ExchangeService service) throws Exception { super(service, ServiceErrorHandling.ThrowOnError); }
Example #22
Source File: ServiceObject.java From ews-java-api with MIT License | 2 votes |
/** * Sets the service. * * @param service the new service */ protected void setService(ExchangeService service) { this.service = service; }
Example #23
Source File: MoveCopyItemResponse.java From ews-java-api with MIT License | 2 votes |
/** * Gets the object instance delegate. * * @param service the service * @param xmlElementName the xml element name * @return the object instance delegate * @throws Exception the exception */ @Override public ServiceObject getObjectInstanceDelegate(ExchangeService service, String xmlElementName) throws Exception { return this.getObjectInstance(service, xmlElementName); }
Example #24
Source File: DeleteItemRequest.java From ews-java-api with MIT License | 2 votes |
/** * Creates the service response. * * @param service the service * @param responseIndex the response index * @return Service response. */ @Override protected ServiceResponse createServiceResponse(ExchangeService service, int responseIndex) { return new ServiceResponse(); }
Example #25
Source File: SendItemRequest.java From ews-java-api with MIT License | 2 votes |
/** * Creates the service response. * * @param service the service * @param responseIndex the response index * @return Service response. */ @Override protected ServiceResponse createServiceResponse(ExchangeService service, int responseIndex) { return new ServiceResponse(); }
Example #26
Source File: SearchFolder.java From ews-java-api with MIT License | 2 votes |
/** * Binds to an existing search folder and loads its first class property. * Calling this method results in a call to EWS. * * @param service the service * @param id the id * @return A SearchFolder instance representing the search folder * corresponding to the specified Id. * @throws Exception the exception */ public static SearchFolder bind(ExchangeService service, FolderId id) throws Exception { return SearchFolder.bind(service, id, PropertySet .getFirstClassProperties()); }
Example #27
Source File: MultiResponseServiceRequest.java From ews-java-api with MIT License | 2 votes |
/** * Creates the service response. * * @param service The service. * @param responseIndex Index of the response. * @return Service response. * @throws Exception the exception */ protected abstract TResponse createServiceResponse(ExchangeService service, int responseIndex) throws Exception;
Example #28
Source File: ServiceRequestBase.java From ews-java-api with MIT License | 2 votes |
/** * Gets the service. * * @return The service. */ public ExchangeService getService() { return service; }
Example #29
Source File: GetServerTimeZonesRequest.java From ews-java-api with MIT License | 2 votes |
/** * Creates the service response. * * @param service the service * @param responseIndex the response index * @return Service response. */ @Override protected GetServerTimeZonesResponse createServiceResponse( ExchangeService service, int responseIndex) { return new GetServerTimeZonesResponse(); }
Example #30
Source File: GetUserOofSettingsRequest.java From ews-java-api with MIT License | 2 votes |
/** * Initializes a new instance of the class. * * @param service the service * @throws Exception */ public GetUserOofSettingsRequest(ExchangeService service) throws Exception { super(service); }