microsoft.exchange.webservices.data
Class EmailMessage

java.lang.Object
  extended by microsoft.exchange.webservices.data.ServiceObject
      extended by microsoft.exchange.webservices.data.Item
          extended by microsoft.exchange.webservices.data.EmailMessage
Direct Known Subclasses:
MeetingMessage

public class EmailMessage
extends Item

Represents an e-mail message. Properties available on e-mail messages are defined in the EmailMessageSchema class.


Constructor Summary
  EmailMessage(ExchangeService service)
          * Initializes an unsaved local instance of EmailMessage.
protected EmailMessage(ItemAttachment parentAttachment)
          Initializes a new instance of the "EmailMessage" class.
 
Method Summary
static EmailMessage bind(ExchangeService service, ItemId id)
          * Binds to an existing e-mail message and loads its first class properties.Calling this method results in a call to EWS.
static EmailMessage bind(ExchangeService service, ItemId id, PropertySet propertySet)
          * Binds to an existing e-mail message and loads the specified set of properties.Calling this method results in a call to EWS.
 ResponseMessage createForward()
          * Creates a forward response to the message.
 ResponseMessage createReply(boolean replyAll)
          * Creates a reply response to the message.
 void forward(MessageBody bodyPrefix, EmailAddress... toRecipients)
          * Forwards the message.
 void forward(MessageBody bodyPrefix, java.lang.Iterable<EmailAddress> toRecipients)
          * Forwards the message.
 EmailAddressCollection getBccRecipients()
          * Gets the list of Bcc recipients for the e-mail message.
 EmailAddressCollection getCcRecipients()
          * Gets the list of Cc recipients for the e-mail message.
 byte[] getConversationIndex()
          * Gets the conversation index of the e-mail message.
 java.lang.String getConversationTopic()
          * Gets the conversation topic of the e-mail message.
 EmailAddress getFrom()
          * Gets the "on behalf" sender of the e-mail message.
 java.lang.String getInternetMessageId()
          * Gets the Internat Message Id of the e-mail message.
 boolean getIsAssociated()
          * Gets a value indicating whether this is an associated message.
 java.lang.Boolean getIsDeliveryReceiptRequested()
          * Gets a value indicating whether a read receipt is requested for the e-mail message.
 java.lang.Boolean getIsRead()
          * Gets a value indicating whether the e-mail message is read.
 java.lang.Boolean getIsReadReceiptRequested()
          * Gets a value indicating whether a read receipt is requested for the e-mail message.
 java.lang.Boolean getIsResponseRequested()
          * Gets a value indicating whether a response is requested for the e-mail message.
protected  ExchangeVersion getMinimumRequiredServerVersion()
          Gets the minimum required server version.
 EmailAddress getReceivedBy()
          * Gets the ReceivedBy property of the e-mail message.
 EmailAddress getReceivedRepresenting()
          * Gets the ReceivedRepresenting property of the e-mail message.
 java.lang.String getReferences()
          * Gets the references of the e-mail message.
 EmailAddressCollection getReplyTo()
          * Gets a list of e-mail addresses to which replies should be addressed.
protected  ServiceObjectSchema getSchema()
          Method to return the schema associated with this type of object.
 EmailAddress getSender()
          * Gets the sender of the e-mail message.
 EmailAddressCollection getToRecipients()
          Gets the list of To recipients for the e-mail message.
 void reply(MessageBody bodyPrefix, boolean replyAll)
          * Replies to the message.
 void send()
          Sends this e-mail message.
 void sendAndSaveCopy()
          * Sends this e-mail message and saves a copy of it in the Sent Items folder.
 void sendAndSaveCopy(FolderId destinationFolderId)
          * Sends this e-mail message and saves a copy of it in the specified folder.
 void sendAndSaveCopy(WellKnownFolderName destinationFolderName)
          * Sends this e-mail message and saves a copy of it in the specified folder.
 void setFrom(EmailAddress value)
          Sets the from.
 void setIsAssociated(boolean value)
          Sets the checks if is associated.
 void setIsDeliveryReceiptRequested(java.lang.Boolean value)
          Sets the checks if is delivery receipt requested.
 void setIsRead(java.lang.Boolean value)
          Sets the checks if is read.
 void setIsReadReceiptRequested(java.lang.Boolean value)
          Sets the checks if is read receipt requested.
 void setIsResponseRequested(java.lang.Boolean value)
          Sets the checks if is response requested.
 void setReferences(java.lang.String value)
          Sets the references.
 void setSender(EmailAddress value)
          Sets the sender.
 void suppressReadReceipt()
          * Suppresses the read receipt on the message.
 
Methods inherited from class microsoft.exchange.webservices.data.Item
copy, copy, delete, getAllowedResponseActions, getAttachments, getBody, getCategories, getConversationId, getCulture, getDateTimeCreated, getDateTimeReceived, getDateTimeSent, getDefaultAffectedTaskOccurrences, getDefaultSendCancellationsMode, getDefaultSendInvitationsMode, getDefaultSendInvitationsOrCancellationsMode, getDisplayCc, getDisplayTo, getEffectiveRights, getExtendedProperties, getHasAttachments, getId, getIdPropertyDefinition, getImportance, getInReplyTo, getInternetMessageHeaders, getIsDraft, getIsFromMe, getIsNew, getIsReminderSet, getIsResend, getIsSubmitted, getIsTimeZoneHeaderRequired, getIsUnmodified, getItemClass, getLastModifiedName, getLastModifiedTime, getMimeContent, getParentAttachment, getParentFolderId, getReminderDueBy, getReminderMinutesBeforeStart, getRootItemId, getSensitivity, getSize, getSubject, getUniqueBody, getWebClientEditFormQueryString, getWebClientReadFormQueryString, hasUnprocessedAttachmentChanges, internalCreate, internalDelete, internalLoad, internalUpdate, isAttachment, move, move, removeExtendedProperty, save, save, save, setBody, setCategories, setCulture, setExtendedProperty, setImportance, setInReplyTo, setIsReminderSet, setItemClass, setMimeContent, setReminderDueBy, setReminderMinutesBeforeStart, setSensitivity, setSubject, setSubject, throwIfThisIsAttachment, update, validate
 
Methods inherited from class microsoft.exchange.webservices.data.ServiceObject
addServiceObjectChangedEvent, changed, clearChangeLog, clearServiceObjectChangedEvent, getChangeXmlElementName, getDeleteFieldXmlElementName, getIsCustomDateTimeScopingRequired, getLoadedPropertyDefinitions, getObjectFromPropertyDefinition, getPropertyBag, getService, getSetFieldXmlElementName, getXmlElementName, getXmlElementNameOverride, isDirty, isNew, load, load, loadFromXml, loadFromXml, removeServiceObjectChangedEvent, schema, setService, throwIfThisIsNew, throwIfThisIsNotNew, tryGetExtendedProperty, tryGetProperty, tryGetProperty, writeToXml, writeToXmlForUpdate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmailMessage

public EmailMessage(ExchangeService service)
             throws java.lang.Exception
* Initializes an unsaved local instance of EmailMessage. To bind to an existing e-mail message, use EmailMessage.Bind() instead.

Parameters:
service - The ExchangeService object to which the e-mail message will be bound.
Throws:
java.lang.Exception - the exception

EmailMessage

protected EmailMessage(ItemAttachment parentAttachment)
                throws java.lang.Exception
Initializes a new instance of the "EmailMessage" class.

Parameters:
parentAttachment - The parent attachment.
Throws:
java.lang.Exception - the exception
Method Detail

bind

public static EmailMessage bind(ExchangeService service,
                                ItemId id,
                                PropertySet propertySet)
                         throws java.lang.Exception
* Binds to an existing e-mail message and loads the specified set of properties.Calling this method results in a call to EWS.

Parameters:
service - the service
id - the id
propertySet - the property set
Returns:
An EmailMessage instance representing the e-mail message corresponding to the specified Id
Throws:
java.lang.Exception - the exception

bind

public static EmailMessage bind(ExchangeService service,
                                ItemId id)
                         throws java.lang.Exception
* Binds to an existing e-mail message and loads its first class properties.Calling this method results in a call to EWS.

Parameters:
service - the service
id - the id
Returns:
An EmailMessage instance representing the e-mail message corresponding to the specified Id
Throws:
java.lang.Exception - the exception

getSchema

protected ServiceObjectSchema getSchema()
Method to return the schema associated with this type of object.

Overrides:
getSchema in class Item
Returns:
The schema associated with this type of object.

getMinimumRequiredServerVersion

protected ExchangeVersion getMinimumRequiredServerVersion()
Gets the minimum required server version.

Overrides:
getMinimumRequiredServerVersion in class Item
Returns:
Earliest Exchange version in which this service object type is supported.

createReply

public ResponseMessage createReply(boolean replyAll)
                            throws java.lang.Exception
* Creates a reply response to the message.

Parameters:
replyAll - the reply all
Returns:
A ResponseMessage representing the reply response that can subsequently be modified and sent.
Throws:
java.lang.Exception - the exception

createForward

public ResponseMessage createForward()
                              throws java.lang.Exception
* Creates a forward response to the message.

Returns:
A ResponseMessage representing the forward response that can subsequently be modified and sent.
Throws:
java.lang.Exception - the exception

reply

public void reply(MessageBody bodyPrefix,
                  boolean replyAll)
           throws java.lang.Exception
* Replies to the message. Calling this method results in a call to EWS.

Parameters:
bodyPrefix - the body prefix
replyAll - the reply all
Throws:
java.lang.Exception - the exception

forward

public void forward(MessageBody bodyPrefix,
                    EmailAddress... toRecipients)
             throws java.lang.Exception
* Forwards the message. Calling this method results in a call to EWS.

Parameters:
bodyPrefix - the body prefix
toRecipients - the to recipients
Throws:
java.lang.Exception - the exception

forward

public void forward(MessageBody bodyPrefix,
                    java.lang.Iterable<EmailAddress> toRecipients)
             throws java.lang.Exception
* Forwards the message. Calling this method results in a call to EWS.

Parameters:
bodyPrefix - the body prefix
toRecipients - the to recipients
Throws:
java.lang.Exception - the exception

send

public void send()
          throws java.lang.Exception
Sends this e-mail message. Calling this method results in at least one call to EWS.

Throws:
java.lang.Exception - the exception

sendAndSaveCopy

public void sendAndSaveCopy(FolderId destinationFolderId)
                     throws java.lang.Exception
* Sends this e-mail message and saves a copy of it in the specified folder. SendAndSaveCopy does not work if the message has unsaved attachments. In that case, the message must first be saved and then sent. Calling this method results in a call to EWS.

Parameters:
destinationFolderId - the destination folder id
Throws:
java.lang.Exception - the exception

sendAndSaveCopy

public void sendAndSaveCopy(WellKnownFolderName destinationFolderName)
                     throws java.lang.Exception
* Sends this e-mail message and saves a copy of it in the specified folder. SendAndSaveCopy does not work if the message has unsaved attachments. In that case, the message must first be saved and then sent. Calling this method results in a call to EWS.

Parameters:
destinationFolderName - the destination folder name
Throws:
java.lang.Exception - the exception

sendAndSaveCopy

public void sendAndSaveCopy()
                     throws java.lang.Exception
* Sends this e-mail message and saves a copy of it in the Sent Items folder. SendAndSaveCopy does not work if the message has unsaved attachments. In that case, the message must first be saved and then sent. Calling this method results in a call to EWS.

Throws:
java.lang.Exception - the exception

suppressReadReceipt

public void suppressReadReceipt()
                         throws java.lang.Exception
* Suppresses the read receipt on the message. Calling this method results in a call to EWS.

Throws:
java.lang.Exception - the exception

getToRecipients

public EmailAddressCollection getToRecipients()
                                       throws ServiceLocalException
Gets the list of To recipients for the e-mail message.

Returns:
The list of To recipients for the e-mail message.
Throws:
ServiceLocalException - the service local exception

getBccRecipients

public EmailAddressCollection getBccRecipients()
                                        throws ServiceLocalException
* Gets the list of Bcc recipients for the e-mail message.

Returns:
the bcc recipients
Throws:
ServiceLocalException - the service local exception

getCcRecipients

public EmailAddressCollection getCcRecipients()
                                       throws ServiceLocalException
* Gets the list of Cc recipients for the e-mail message.

Returns:
the cc recipients
Throws:
ServiceLocalException - the service local exception

getConversationTopic

public java.lang.String getConversationTopic()
                                      throws ServiceLocalException
* Gets the conversation topic of the e-mail message.

Returns:
the conversation topic
Throws:
ServiceLocalException - the service local exception

getConversationIndex

public byte[] getConversationIndex()
                            throws ServiceLocalException
* Gets the conversation index of the e-mail message.

Returns:
the conversation index
Throws:
ServiceLocalException - the service local exception

getFrom

public EmailAddress getFrom()
                     throws ServiceLocalException
* Gets the "on behalf" sender of the e-mail message.

Returns:
the from
Throws:
ServiceLocalException - the service local exception

setFrom

public void setFrom(EmailAddress value)
             throws java.lang.Exception
Sets the from.

Parameters:
value - the new from
Throws:
java.lang.Exception - the exception

getIsAssociated

public boolean getIsAssociated()
                        throws ServiceLocalException
* Gets a value indicating whether this is an associated message.

Overrides:
getIsAssociated in class Item
Returns:
the checks if is associated
Throws:
ServiceLocalException - the service local exception

setIsAssociated

public void setIsAssociated(boolean value)
                     throws java.lang.Exception
Sets the checks if is associated.

Parameters:
value - the new checks if is associated
Throws:
java.lang.Exception - the exception

getIsDeliveryReceiptRequested

public java.lang.Boolean getIsDeliveryReceiptRequested()
                                                throws ServiceLocalException
* Gets a value indicating whether a read receipt is requested for the e-mail message.

Returns:
the checks if is delivery receipt requested
Throws:
ServiceLocalException - the service local exception

setIsDeliveryReceiptRequested

public void setIsDeliveryReceiptRequested(java.lang.Boolean value)
                                   throws java.lang.Exception
Sets the checks if is delivery receipt requested.

Parameters:
value - the new checks if is delivery receipt requested
Throws:
java.lang.Exception - the exception

getIsRead

public java.lang.Boolean getIsRead()
                            throws ServiceLocalException
* Gets a value indicating whether the e-mail message is read.

Returns:
the checks if is read
Throws:
ServiceLocalException - the service local exception

setIsRead

public void setIsRead(java.lang.Boolean value)
               throws java.lang.Exception
Sets the checks if is read.

Parameters:
value - the new checks if is read
Throws:
java.lang.Exception - the exception

getIsReadReceiptRequested

public java.lang.Boolean getIsReadReceiptRequested()
                                            throws ServiceLocalException
* Gets a value indicating whether a read receipt is requested for the e-mail message.

Returns:
the checks if is read receipt requested
Throws:
ServiceLocalException - the service local exception

setIsReadReceiptRequested

public void setIsReadReceiptRequested(java.lang.Boolean value)
                               throws java.lang.Exception
Sets the checks if is read receipt requested.

Parameters:
value - the new checks if is read receipt requested
Throws:
java.lang.Exception - the exception

getIsResponseRequested

public java.lang.Boolean getIsResponseRequested()
                                         throws ServiceLocalException
* Gets a value indicating whether a response is requested for the e-mail message.

Returns:
the checks if is response requested
Throws:
ServiceLocalException - the service local exception

setIsResponseRequested

public void setIsResponseRequested(java.lang.Boolean value)
                            throws java.lang.Exception
Sets the checks if is response requested.

Parameters:
value - the new checks if is response requested
Throws:
java.lang.Exception - the exception

getInternetMessageId

public java.lang.String getInternetMessageId()
                                      throws ServiceLocalException
* Gets the Internat Message Id of the e-mail message.

Returns:
the internet message id
Throws:
ServiceLocalException - the service local exception

getReferences

public java.lang.String getReferences()
                               throws ServiceLocalException
* Gets the references of the e-mail message.

Returns:
the references
Throws:
ServiceLocalException - the service local exception

setReferences

public void setReferences(java.lang.String value)
                   throws java.lang.Exception
Sets the references.

Parameters:
value - the new references
Throws:
java.lang.Exception - the exception

getReplyTo

public EmailAddressCollection getReplyTo()
                                  throws ServiceLocalException
* Gets a list of e-mail addresses to which replies should be addressed.

Returns:
the reply to
Throws:
ServiceLocalException - the service local exception

getSender

public EmailAddress getSender()
                       throws ServiceLocalException
* Gets the sender of the e-mail message.

Returns:
the sender
Throws:
ServiceLocalException - the service local exception

setSender

public void setSender(EmailAddress value)
               throws java.lang.Exception
Sets the sender.

Parameters:
value - the new sender
Throws:
java.lang.Exception - the exception

getReceivedBy

public EmailAddress getReceivedBy()
                           throws ServiceLocalException
* Gets the ReceivedBy property of the e-mail message.

Returns:
the received by
Throws:
ServiceLocalException - the service local exception

getReceivedRepresenting

public EmailAddress getReceivedRepresenting()
                                     throws ServiceLocalException
* Gets the ReceivedRepresenting property of the e-mail message.

Returns:
the received representing
Throws:
ServiceLocalException - the service local exception