com.moyosoft.exchange.item
Interface ExchangeItem

All Known Subinterfaces:
ExchangeCalendarItem, ExchangeContact, ExchangeMail, ExchangeMeetingMessage, ExchangeMeetingRequest, ExchangeResponseMail, ExchangeTask, StickyNote

public interface ExchangeItem

Base interface for all Exchange items. Specific sub-interfaces like ExchangeContact, ExchangeMail or ExchangeCalendarItem represents concrete typed Exchange items.

The ExchangeFolder object contains methods to create Exchange items in a specific folder: createItem(ItemType), createContact(), createMail(), etc.

Example code that iterates over items in the Contacts folder:

Exchange exchange = new Exchange("hostname", "username", "password");
ItemsCollection items = exchange.getContactsFolder().getItems();

for(ExchangeItem item : items)
{
  System.out.println(item.getItemId());
}


Method Summary
 ExchangeItem copyTo(ExchangeFolder folder)
          Creates a copy of this item in the specified folder.
 ExchangeItem copyTo(ExchangeFolder folder, boolean searchCopiedItem)
           
 void delete(boolean moveToDeletedItems)
          Deletes this item.
 AttachmentsCollection getAttachments()
          Returns a collection containing attachments attached to this item.
 java.lang.String getBody()
          Returns the body of this item.
 java.lang.String getBodyAsText()
          Returns the body of this item in text format in the case an HTML body type is used.
 BodyType getBodyType()
          Returns the type of the body of this item (Text or HTML).
 java.util.List<java.lang.String> getCategories()
          Returns a list of Strings that identify to which categories an item in the mailbox belongs.
 java.lang.String getCulture()
           
 java.util.Date getDateTimeCreated()
          Returns the date and time that this item was created.
 java.util.Date getDateTimeReceived()
          Returns the date and time that this item was received in a mailbox.
 java.util.Date getDateTimeSent()
          Returns the date and time that this item was sent.
 java.lang.String getDisplayCc()
          Returns the display string that is used for the contents of the CC box.
 java.lang.String getDisplayTo()
          Returns the display string that is used for the contents of the To box.
 ExtendedProperties getExtendedProperties()
           
 ImportanceChoices getImportance()
          Returns the importance of this item.
 java.lang.String getInReplyTo()
          Represents the identifier of the item to which this item is a reply.
 java.util.List<InternetHeader> getInternetMessageHeaders()
          Returns a list of all Internet message headers of this item.
 java.lang.String getItemClass()
          Returns the message class of this item.
 java.lang.String getItemId()
          Returns a unique identifier for this item.
 java.lang.String getItemIdChangeKey()
          Returns the change key for this item.
 ItemType getItemType()
          Returns the type of this item or null if the type is unknown.
 java.lang.String getLastModifiedName()
          Returns the display name of the last user who modified this item.
 java.util.Date getLastModifiedTime()
          Returns the date and time when this item has been modified for the last time.
 java.lang.String getMimeContent()
          Returns the native Multipurpose Internet Mail Extensions (MIME) stream.
 byte[] getMimeContentBytes()
          Returns the native Multipurpose Internet Mail Extensions (MIME) stream as a bytes array.
 java.lang.String getMimeContentCharacterSet()
          Returns the ISO name of the character set used in the MIME message.
 java.io.Reader getMimeContentReader()
          Returns the native Multipurpose Internet Mail Extensions (MIME) stream.
 java.io.InputStream getMimeContentStream()
          Returns the native Multipurpose Internet Mail Extensions (MIME) stream.
 ExchangeFolder getParentFolder()
          Returns the parent folder containing this item.
 java.lang.String getParentFolderId()
          Returns the unique identifier of the parent folder containing this item.
 java.lang.String getParentFolderIdChangeKey()
          Returns the change key of the parent folder containing this item.
 java.util.Date getReminderDueBy()
          Returns the date and time when this event occurs.
 int getReminderMinutesBeforeStart()
          Returns the number of minutes before the reminder due date when the reminder will be displayed.
 java.util.List<ResponseMailType> getResponsesTypes()
           
 SensitivityChoices getSensitivity()
          Returns the sensitivity level of this item.
 int getSize()
          Returns the size in bytes of this item.
 java.lang.String getSubject()
          Returns the subject of this item.
 boolean hasVisibleAttachments()
          Returns true if this item has at least one visible attachment, false otherwise.
 boolean isDraft()
          Returns true if this item is a draft and has not yet been sent, false otherwise.
 boolean isFromMe()
          Indicates whether a user sent this item to itself.
 boolean isReminderSet()
          Returns true is a reminder is set for this item.
 boolean isResend()
          Returns true if this item item had previously been sent.
 boolean isStored()
          Returns true if this item exists in the Exchange store; false if this item was never saved or was deleted.
 boolean isSubmitted()
          Returns true if this item has been submitted to the Outbox default folder.
 void moveTo(ExchangeFolder folder)
          Moves this item to the specified folder.
 void moveTo(ExchangeFolder folder, boolean searchMovedItem)
           
 void save()
          Saves all the changes made to this item in the Exchange store.
 void save(boolean overwriteIfConflict)
          Saves all the changes made to this item in the Exchange store.
 void saveTo(java.io.File file)
          Saves the content of this message to the specified file in RFC-822 format (EML format).
 void setBody(java.lang.String body)
          Sets the body of this item.
 void setBody(java.lang.String body, BodyType type)
          Sets the body of this item in Text or HTML format depending on the type specified.
 void setCategories(java.util.List<java.lang.String> categories)
          Sets the list of categories to which an item belongs.
 void setCulture(java.lang.String culture)
           
 void setImportance(ImportanceChoices importance)
          Sets the importance of this item.
 void setMimeContent(byte[] mimeContent)
          Sets the MIME content.
 void setMimeContent(java.io.InputStream mimeContent)
          Sets the MIME content.
 void setMimeContent(java.lang.String mimeContent)
          Sets the MIME content.
 void setReminder(java.util.Date reminderDueBy, boolean isReminderSet, int remindMinutesBeforeStart)
          Sets a reminder for this item.
 void setSensitivity(SensitivityChoices sensitivity)
          Sets the sensitivity level of this item.
 void setSubject(java.lang.String subject)
          Sets the subject of this item.
 

Method Detail

getMimeContentStream

java.io.InputStream getMimeContentStream()
                                         throws ExchangeServiceException
Returns the native Multipurpose Internet Mail Extensions (MIME) stream.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getMimeContentReader

java.io.Reader getMimeContentReader()
                                    throws ExchangeServiceException
Returns the native Multipurpose Internet Mail Extensions (MIME) stream.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getMimeContent

java.lang.String getMimeContent()
                                throws ExchangeServiceException
Returns the native Multipurpose Internet Mail Extensions (MIME) stream.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getMimeContentBytes

byte[] getMimeContentBytes()
                           throws ExchangeServiceException
Returns the native Multipurpose Internet Mail Extensions (MIME) stream as a bytes array.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getMimeContentCharacterSet

java.lang.String getMimeContentCharacterSet()
                                            throws ExchangeServiceException
Returns the ISO name of the character set used in the MIME message.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

setMimeContent

void setMimeContent(java.lang.String mimeContent)
                    throws ExchangeServiceException
Sets the MIME content.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

setMimeContent

void setMimeContent(byte[] mimeContent)
                    throws ExchangeServiceException
Sets the MIME content.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

setMimeContent

void setMimeContent(java.io.InputStream mimeContent)
                    throws ExchangeServiceException,
                           java.io.IOException
Sets the MIME content.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
java.io.IOException

getItemId

java.lang.String getItemId()
Returns a unique identifier for this item.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getItemIdChangeKey

java.lang.String getItemIdChangeKey()
Returns the change key for this item. The change key identifies a specific version of this item. Every time this item is modified, the change key will be automatically modified as well.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getParentFolderId

java.lang.String getParentFolderId()
                                   throws ExchangeServiceException
Returns the unique identifier of the parent folder containing this item. Consider using the method getParentFolder() to get the parent folder's ExchangeFolder object.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
See Also:
getParentFolder()

getParentFolderIdChangeKey

java.lang.String getParentFolderIdChangeKey()
                                            throws ExchangeServiceException
Returns the change key of the parent folder containing this item.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getParentFolder

ExchangeFolder getParentFolder()
                               throws ExchangeServiceException
Returns the parent folder containing this item.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getItemClass

java.lang.String getItemClass()
                              throws ExchangeServiceException
Returns the message class of this item. The following classes are usually returned:

"IPM.Appointment" for appointments.
"IPM.Contact" for contacts.
"IPM.Activity" for Journal entries.
"IPM.Note" for e-mail messages.
"IPM.StickyNote" for Outlook sticky notes.
"IPM.Task" for tasks.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getItemType

ItemType getItemType()
                     throws ExchangeServiceException
Returns the type of this item or null if the type is unknown. Exact type information is returned by the method getItemClass().

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getSubject

java.lang.String getSubject()
                            throws ExchangeServiceException
Returns the subject of this item.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

setSubject

void setSubject(java.lang.String subject)
                throws ExchangeServiceException
Sets the subject of this item. The subject is limited to 255 characters.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getSensitivity

SensitivityChoices getSensitivity()
                                  throws ExchangeServiceException
Returns the sensitivity level of this item.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

setSensitivity

void setSensitivity(SensitivityChoices sensitivity)
                    throws ExchangeServiceException
Sets the sensitivity level of this item.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getBody

java.lang.String getBody()
                         throws ExchangeServiceException
Returns the body of this item. The type of the body is returned by getBodyType().

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getBodyType

BodyType getBodyType()
                     throws ExchangeServiceException
Returns the type of the body of this item (Text or HTML).

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

setBody

void setBody(java.lang.String body)
             throws ExchangeServiceException
Sets the body of this item.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

setBody

void setBody(java.lang.String body,
             BodyType type)
             throws ExchangeServiceException
Sets the body of this item in Text or HTML format depending on the type specified.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getBodyAsText

java.lang.String getBodyAsText()
                               throws ExchangeServiceException
Returns the body of this item in text format in the case an HTML body type is used. As the HTML is converted to text by the Exchange server, the item may be automatically saved if new or if the body was changed.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getAttachments

AttachmentsCollection getAttachments()
                                     throws ExchangeServiceException
Returns a collection containing attachments attached to this item. This method never returns null, even if this item has no attachments; an empty collection will be returned in this case.

To add new attachments to this item, use the method AttachmentsCollection.add

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getDateTimeReceived

java.util.Date getDateTimeReceived()
                                   throws ExchangeServiceException
Returns the date and time that this item was received in a mailbox.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getSize

int getSize()
            throws ExchangeServiceException
Returns the size in bytes of this item.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getCategories

java.util.List<java.lang.String> getCategories()
                                               throws ExchangeServiceException
Returns a list of Strings that identify to which categories an item in the mailbox belongs.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

setCategories

void setCategories(java.util.List<java.lang.String> categories)
                   throws ExchangeServiceException
Sets the list of categories to which an item belongs.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getImportance

ImportanceChoices getImportance()
                                throws ExchangeServiceException
Returns the importance of this item.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

setImportance

void setImportance(ImportanceChoices importance)
                   throws ExchangeServiceException
Sets the importance of this item.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getInReplyTo

java.lang.String getInReplyTo()
                              throws ExchangeServiceException
Represents the identifier of the item to which this item is a reply.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

isSubmitted

boolean isSubmitted()
                    throws ExchangeServiceException
Returns true if this item has been submitted to the Outbox default folder.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

isDraft

boolean isDraft()
                throws ExchangeServiceException
Returns true if this item is a draft and has not yet been sent, false otherwise.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

isFromMe

boolean isFromMe()
                 throws ExchangeServiceException
Indicates whether a user sent this item to itself.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

isResend

boolean isResend()
                 throws ExchangeServiceException
Returns true if this item item had previously been sent.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getInternetMessageHeaders

java.util.List<InternetHeader> getInternetMessageHeaders()
                                                         throws ExchangeServiceException
Returns a list of all Internet message headers of this item.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getDateTimeSent

java.util.Date getDateTimeSent()
                               throws ExchangeServiceException
Returns the date and time that this item was sent.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getDateTimeCreated

java.util.Date getDateTimeCreated()
                                  throws ExchangeServiceException
Returns the date and time that this item was created.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getResponsesTypes

java.util.List<ResponseMailType> getResponsesTypes()
                                                   throws ExchangeServiceException
Throws:
ExchangeServiceException

getReminderDueBy

java.util.Date getReminderDueBy()
                                throws ExchangeServiceException
Returns the date and time when this event occurs. This value and the value returned by getReminderMinutesBeforeStart() determine when the reminder is displayed.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

setReminder

void setReminder(java.util.Date reminderDueBy,
                 boolean isReminderSet,
                 int remindMinutesBeforeStart)
                 throws ExchangeServiceException
Sets a reminder for this item.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

isReminderSet

boolean isReminderSet()
                      throws ExchangeServiceException
Returns true is a reminder is set for this item.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getReminderMinutesBeforeStart

int getReminderMinutesBeforeStart()
                                  throws ExchangeServiceException
Returns the number of minutes before the reminder due date when the reminder will be displayed.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getDisplayCc

java.lang.String getDisplayCc()
                              throws ExchangeServiceException
Returns the display string that is used for the contents of the CC box. This is the concatenated string of all CC recipient display names.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getDisplayTo

java.lang.String getDisplayTo()
                              throws ExchangeServiceException
Returns the display string that is used for the contents of the To box. This is the concatenated string of all To recipient display names.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

hasVisibleAttachments

boolean hasVisibleAttachments()
                              throws ExchangeServiceException
Returns true if this item has at least one visible attachment, false otherwise.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getExtendedProperties

ExtendedProperties getExtendedProperties()
                                         throws ExchangeServiceException
Throws:
ExchangeServiceException

getCulture

java.lang.String getCulture()
                            throws ExchangeServiceException
Throws:
ExchangeServiceException

setCulture

void setCulture(java.lang.String culture)
                throws ExchangeServiceException
Throws:
ExchangeServiceException

getLastModifiedName

java.lang.String getLastModifiedName()
                                     throws ExchangeServiceException
Returns the display name of the last user who modified this item. Available only in Exchange Server 2007 Service Pack 1 (SP1) and later versions.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

getLastModifiedTime

java.util.Date getLastModifiedTime()
                                   throws ExchangeServiceException
Returns the date and time when this item has been modified for the last time.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

save

void save(boolean overwriteIfConflict)
          throws ExchangeServiceException
Saves all the changes made to this item in the Exchange store.

Parameters:
overwriteIfConflict - if true and a conflict occurs the item will be always overwritten, otherwise an exception will be thrown in case of a conflict.
Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

save

void save()
          throws ExchangeServiceException
Saves all the changes made to this item in the Exchange store. In case of a conflict, the item won't be saved and an exception will be thrown by this method.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

delete

void delete(boolean moveToDeletedItems)
            throws ExchangeServiceException
Deletes this item.

Parameters:
moveToDeletedItems - specifies whether the item is simply moved to the Deleted Items folder or definitely deleted.
Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

moveTo

void moveTo(ExchangeFolder folder)
            throws ExchangeServiceException
Moves this item to the specified folder.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

moveTo

void moveTo(ExchangeFolder folder,
            boolean searchMovedItem)
            throws ExchangeServiceException
Throws:
ExchangeServiceException

copyTo

ExchangeItem copyTo(ExchangeFolder folder)
                    throws ExchangeServiceException
Creates a copy of this item in the specified folder. The copied item is returned.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.

copyTo

ExchangeItem copyTo(ExchangeFolder folder,
                    boolean searchCopiedItem)
                    throws ExchangeServiceException
Throws:
ExchangeServiceException

saveTo

void saveTo(java.io.File file)
            throws ExchangeServiceException,
                   java.io.IOException
Saves the content of this message to the specified file in RFC-822 format (EML format).

This method also saves all the changes made to this item in the Exchange store. In case of a conflict, the item won't be saved and an exception will be thrown by this method.

Throws:
ExchangeServiceException - if any errors occur during the communication with Exchange.
java.io.IOException - if errors occur when writing to the specified file.

isStored

boolean isStored()
                 throws ExchangeServiceException
Returns true if this item exists in the Exchange store; false if this item was never saved or was deleted.

Throws:
ExchangeServiceException