microsoft.exchange.webservices.data.core.service.schema.ItemSchema Java Examples
The following examples show how to use
microsoft.exchange.webservices.data.core.service.schema.ItemSchema.
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: ExchangeFileSystem.java From iaf with Apache License 2.0 | 7 votes |
@Override public Iterator<Item> listFiles(String folder) throws FileSystemException { try { FolderId folderId = findFolder(basefolderId,folder); ItemView view = new ItemView(getMaxNumberOfMessagesToList()); view.getOrderBy().add(ItemSchema.DateTimeReceived, SortDirection.Ascending); FindItemsResults<Item> findResults; if ("NDR".equalsIgnoreCase(getFilter())) { SearchFilter searchFilterBounce = new SearchFilter.IsEqualTo(ItemSchema.ItemClass, "REPORT.IPM.Note.NDR"); findResults = exchangeService.findItems(folderId,searchFilterBounce, view); } else { findResults = exchangeService.findItems(folderId, view); } if (findResults.getTotalCount() == 0) { return null; } else { return findResults.getItems().iterator(); } } catch (Exception e) { throw new FileSystemException("Cannot list messages in folder ["+folder+"]", e); } }
Example #2
Source File: ExchangeMailListener.java From iaf with Apache License 2.0 | 5 votes |
@Override public Message extractMessage(Item rawMessage, Map<String,Object> threadContext) throws ListenerException { if (!EMAIL_MESSAGE_TYPE.equals(getMessageType())) { return super.extractMessage(rawMessage, threadContext); } Item item = (Item) rawMessage; try { XmlBuilder emailXml = new XmlBuilder("email"); EmailMessage emailMessage; PropertySet ps; if (isSimple()) { ps = new PropertySet(EmailMessageSchema.Subject); emailMessage = EmailMessage.bind(getFileSystem().getExchangeService(), item.getId(), ps); emailMessage.load(); addEmailInfoSimple(emailMessage, emailXml); } else { ps = new PropertySet(EmailMessageSchema.DateTimeReceived, EmailMessageSchema.From, EmailMessageSchema.Subject, EmailMessageSchema.Body, EmailMessageSchema.DateTimeSent); emailMessage = EmailMessage.bind(getFileSystem().getExchangeService(), item.getId(), ps); emailMessage.load(); addEmailInfo(emailMessage, emailXml); } if (StringUtils.isNotEmpty(getStoreEmailAsStreamInSessionKey())) { emailMessage.load(new PropertySet(ItemSchema.MimeContent)); MimeContent mc = emailMessage.getMimeContent(); ByteArrayInputStream bis = new ByteArrayInputStream(mc.getContent()); threadContext.put(getStoreEmailAsStreamInSessionKey(), bis); } return new Message(emailXml.toXML()); } catch (Exception e) { throw new ListenerException(e); } }
Example #3
Source File: ExchangeFileSystem.java From iaf with Apache License 2.0 | 5 votes |
@Override public boolean exists(Item f) throws FileSystemException { try { ItemView view = new ItemView(1); view.getOrderBy().add(ItemSchema.DateTimeReceived, SortDirection.Ascending); SearchFilter searchFilter = new SearchFilter.IsEqualTo(ItemSchema.Id, f.getId().toString()); FindItemsResults<Item> findResults; findResults = exchangeService.findItems(basefolderId,searchFilter, view); return findResults.getTotalCount()!=0; } catch (Exception e) { throw new FileSystemException(e); } }
Example #4
Source File: CalendarResponseMessage.java From ews-java-api with MIT License | 5 votes |
/** * Gets the internet message headers. * * @return the internet message headers * @throws Exception the exception */ protected InternetMessageHeaderCollection getInternetMessageHeaders() throws Exception { return (InternetMessageHeaderCollection) this .getObjectFromPropertyDefinition( ItemSchema.InternetMessageHeaders); }
Example #5
Source File: ConsumeEWS.java From localization_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"); 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)); 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 #6
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 #7
Source File: Item.java From ews-java-api with MIT License | 2 votes |
/** * Gets a value indicating the effective rights the current authenticated * user has on this item. * * @return the effective rights * @throws ServiceLocalException the service local exception */ public EnumSet<EffectiveRights> getEffectiveRights() throws ServiceLocalException { return getPropertyBag().getObjectFromPropertyDefinition( ItemSchema.EffectiveRights); }
Example #8
Source File: ResponseMessage.java From ews-java-api with MIT License | 2 votes |
/** * Sets the body. * * @param value the new body * @throws Exception the exception */ public void setBody(MessageBody value) throws Exception { this.getPropertyBag().setObjectFromPropertyDefinition(ItemSchema.Body, value); }
Example #9
Source File: CalendarResponseMessage.java From ews-java-api with MIT License | 2 votes |
/** * Gets the body of the response. * * @return the body * @throws Exception the exception */ public MessageBody getBody() throws Exception { return (MessageBody) this .getObjectFromPropertyDefinition(ItemSchema.Body); }
Example #10
Source File: CalendarResponseMessage.java From ews-java-api with MIT License | 2 votes |
/** * Gets a list of attachments to this response. * * @return the attachments * @throws Exception the exception */ public AttachmentCollection getAttachments() throws Exception { return (AttachmentCollection) this .getObjectFromPropertyDefinition(ItemSchema.Attachments); }
Example #11
Source File: CalendarResponseMessage.java From ews-java-api with MIT License | 2 votes |
/** * Sets the sensitivity. * * @param value the new sensitivity * @throws Exception the exception */ public void setSensitivity(Sensitivity value) throws Exception { this.getPropertyBag().setObjectFromPropertyDefinition( ItemSchema.Sensitivity, value); }
Example #12
Source File: CalendarResponseMessage.java From ews-java-api with MIT License | 2 votes |
/** * Gets the sensitivity of this response. * * @return the sensitivity * @throws Exception the exception */ public Sensitivity getSensitivity() throws Exception { return (Sensitivity) this .getObjectFromPropertyDefinition(ItemSchema.Sensitivity); }
Example #13
Source File: CalendarResponseMessage.java From ews-java-api with MIT License | 2 votes |
/** * Sets the item class. * * @param value the new item class * @throws Exception the exception */ protected void setItemClass(String value) throws Exception { this.getPropertyBag().setObjectFromPropertyDefinition( ItemSchema.ItemClass, value); }
Example #14
Source File: CalendarResponseMessage.java From ews-java-api with MIT License | 2 votes |
/** * Gets the item class. * * @return the item class * @throws Exception the exception */ protected String getItemClass() throws Exception { return (String) this .getObjectFromPropertyDefinition(ItemSchema.ItemClass); }
Example #15
Source File: CalendarResponseMessage.java From ews-java-api with MIT License | 2 votes |
/** * Sets the body. * * @param value the new body * @throws Exception the exception */ public void setBody(MessageBody value) throws Exception { this.getPropertyBag().setObjectFromPropertyDefinition(ItemSchema.Body, value); }
Example #16
Source File: Item.java From ews-java-api with MIT License | 2 votes |
/** * Gets the body part that is unique to the conversation this item is part * of. * * @return the unique body * @throws ServiceLocalException the service local exception */ public UniqueBody getUniqueBody() throws ServiceLocalException { return getPropertyBag().getObjectFromPropertyDefinition( ItemSchema.UniqueBody); }
Example #17
Source File: ResponseMessage.java From ews-java-api with MIT License | 2 votes |
/** * Gets the body of the response. * * @return the body * @throws Exception the exception */ public MessageBody getBody() throws Exception { return (MessageBody) this .getObjectFromPropertyDefinition(ItemSchema.Body); }
Example #18
Source File: Item.java From ews-java-api with MIT License | 2 votes |
/** * Gets the query string that should be appended to the Exchange Web client * URL to open this item using the appropriate read form in a web browser. * * @return the web client edit form query string * @throws ServiceLocalException the service local exception */ public String getWebClientEditFormQueryString() throws ServiceLocalException { return getPropertyBag().getObjectFromPropertyDefinition( ItemSchema.WebClientEditFormQueryString); }
Example #19
Source File: Item.java From ews-java-api with MIT License | 2 votes |
/** * Gets the query string that should be appended to the Exchange Web client * URL to open this item using the appropriate read form in a web browser. * * @return the web client read form query string * @throws ServiceLocalException the service local exception */ public String getWebClientReadFormQueryString() throws ServiceLocalException { return getPropertyBag().getObjectFromPropertyDefinition( ItemSchema.WebClientReadFormQueryString); }
Example #20
Source File: Item.java From ews-java-api with MIT License | 2 votes |
/** * Gets the subject. * * @return the subject * @throws ServiceLocalException the service local exception */ public String getSubject() throws ServiceLocalException { return getPropertyBag().getObjectFromPropertyDefinition( ItemSchema.Subject); }
Example #21
Source File: Item.java From ews-java-api with MIT License | 2 votes |
/** * Sets the subject. * * @param subject the new subject * @throws Exception the exception */ public void setSubject(String subject) throws Exception { this.getPropertyBag().setObjectFromPropertyDefinition( ItemSchema.Subject, subject); }
Example #22
Source File: Item.java From ews-java-api with MIT License | 2 votes |
/** * Sets the item class. * * @param value the new item class * @throws Exception the exception */ public void setItemClass(String value) throws Exception { this.getPropertyBag().setObjectFromPropertyDefinition( ItemSchema.ItemClass, value); }
Example #23
Source File: Item.java From ews-java-api with MIT License | 2 votes |
/** * Gets the custom class name of this item. * * @return the item class * @throws ServiceLocalException the service local exception */ public String getItemClass() throws ServiceLocalException { return getPropertyBag().getObjectFromPropertyDefinition( ItemSchema.ItemClass); }
Example #24
Source File: Item.java From ews-java-api with MIT License | 2 votes |
/** * Sets the body. * * @param value the new body * @throws Exception the exception */ public void setBody(MessageBody value) throws Exception { this.getPropertyBag().setObjectFromPropertyDefinition(ItemSchema.Body, value); }
Example #25
Source File: Item.java From ews-java-api with MIT License | 2 votes |
/** * Gets the body of this item. * * @return MessageBody * @throws ServiceLocalException the service local exception */ public MessageBody getBody() throws ServiceLocalException { return getPropertyBag().getObjectFromPropertyDefinition(ItemSchema.Body); }
Example #26
Source File: Item.java From ews-java-api with MIT License | 2 votes |
/** * Gets a value indicating whether the item has attachments. * * @return the checks for attachments * @throws ServiceLocalException the service local exception */ public boolean getHasAttachments() throws ServiceLocalException { return getPropertyBag().<Boolean>getObjectFromPropertyDefinition( ItemSchema.HasAttachments); }
Example #27
Source File: Item.java From ews-java-api with MIT License | 2 votes |
/** * Gets a text summarizing the To recipients of this item. * * @return the display to * @throws ServiceLocalException the service local exception */ public String getDisplayTo() throws ServiceLocalException { return getPropertyBag().getObjectFromPropertyDefinition( ItemSchema.DisplayTo); }
Example #28
Source File: Item.java From ews-java-api with MIT License | 2 votes |
/** * Gets a text summarizing the Cc receipients of this item. * * @return the display cc * @throws ServiceLocalException the service local exception */ public String getDisplayCc() throws ServiceLocalException { return getPropertyBag().getObjectFromPropertyDefinition( ItemSchema.DisplayCc); }
Example #29
Source File: Item.java From ews-java-api with MIT License | 2 votes |
/** * Gets the number of minutes before the start of this item when the * reminder should be triggered. * * @return the reminder minutes before start * @throws ServiceLocalException the service local exception */ public int getReminderMinutesBeforeStart() throws ServiceLocalException { return getPropertyBag().<Integer>getObjectFromPropertyDefinition( ItemSchema.ReminderMinutesBeforeStart); }
Example #30
Source File: Item.java From ews-java-api with MIT License | 2 votes |
/** * Gets the date and time this item was last modified. * * @return the last modified time * @throws ServiceLocalException the service local exception */ public Date getLastModifiedTime() throws ServiceLocalException { return getPropertyBag().getObjectFromPropertyDefinition( ItemSchema.LastModifiedTime); }