Class EmailMessage
- java.lang.Object
-
- microsoft.exchange.webservices.data.core.service.ServiceObject
-
- microsoft.exchange.webservices.data.core.service.item.Item
-
- microsoft.exchange.webservices.data.core.service.item.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
Constructors Constructor Description EmailMessage(ExchangeService service)Initializes an unsaved local instance of EmailMessage.EmailMessage(ExchangeService service, ItemId itemId)EmailMessage(ItemAttachment parentAttachment)Initializes a new instance of the "EmailMessage" class.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EmailMessagebind(ExchangeService service, ItemId id)Binds to an existing e-mail message and loads its first class property.Calling this method results in a call to EWS.static EmailMessagebind(ExchangeService service, ItemId id, PropertySet propertySet)Binds to an existing e-mail message and loads the specified set of property.Calling this method results in a call to EWS.ResponseMessagecreateForward()Creates a forward response to the message.ResponseMessagecreateReply(boolean replyAll)Creates a reply response to the message.voidforward(MessageBody bodyPrefix, Iterable<EmailAddress> toRecipients)Forwards the message.voidforward(MessageBody bodyPrefix, EmailAddress... toRecipients)Forwards the message.EmailAddressCollectiongetBccRecipients()Gets the list of Bcc recipients for the e-mail message.EmailAddressCollectiongetCcRecipients()Gets the list of Cc recipients for the e-mail message.byte[]getConversationIndex()Gets the conversation index of the e-mail message.StringgetConversationTopic()Gets the conversation topic of the e-mail message.EmailAddressgetFrom()Gets the "on behalf" sender of the e-mail message.StringgetInternetMessageId()Gets the Internat Message Id of the e-mail message.booleangetIsAssociated()Gets a value indicating whether this is an associated message.BooleangetIsDeliveryReceiptRequested()Gets a value indicating whether a read receipt is requested for the e-mail message.BooleangetIsRead()Gets a value indicating whether the e-mail message is read.BooleangetIsReadReceiptRequested()Gets a value indicating whether a read receipt is requested for the e-mail message.BooleangetIsResponseRequested()Gets a value indicating whether a response is requested for the e-mail message.ExchangeVersiongetMinimumRequiredServerVersion()Gets the minimum required server version.EmailAddressgetReceivedBy()Gets the ReceivedBy property of the e-mail message.EmailAddressgetReceivedRepresenting()Gets the ReceivedRepresenting property of the e-mail message.StringgetReferences()Gets the references of the e-mail message.EmailAddressCollectiongetReplyTo()Gets a list of e-mail addresses to which replies should be addressed.ServiceObjectSchemagetSchema()Method to return the schema associated with this type of object.EmailAddressgetSender()Gets the sender of the e-mail message.EmailAddressCollectiongetToRecipients()Gets the list of To recipients for the e-mail message.voidreply(MessageBody bodyPrefix, boolean replyAll)Replies to the message.voidsend()Sends this e-mail message.voidsendAndSaveCopy()Sends this e-mail message and saves a copy of it in the Sent Items folder.voidsendAndSaveCopy(WellKnownFolderName destinationFolderName)Sends this e-mail message and saves a copy of it in the specified folder.voidsendAndSaveCopy(FolderId destinationFolderId)Sends this e-mail message and saves a copy of it in the specified folder.voidsetFrom(EmailAddress value)Sets the from.voidsetIsAssociated(boolean value)Sets the checks if is associated.voidsetIsDeliveryReceiptRequested(Boolean value)Sets the checks if is delivery receipt requested.voidsetIsRead(Boolean value)Sets the checks if is read.voidsetIsReadReceiptRequested(Boolean value)Sets the checks if is read receipt requested.voidsetIsResponseRequested(Boolean value)Sets the checks if is response requested.voidsetReferences(String value)Sets the references.voidsetSender(EmailAddress value)Sets the sender.voidsuppressReadReceipt()Suppresses the read receipt on the message.-
Methods inherited from class microsoft.exchange.webservices.data.core.service.item.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, throwIfThisIsAttachment, update, validate
-
Methods inherited from class microsoft.exchange.webservices.data.core.service.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
-
-
-
-
Constructor Detail
-
EmailMessage
public EmailMessage(ExchangeService service) throws 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:
Exception- the exception
-
EmailMessage
public EmailMessage(ExchangeService service, ItemId itemId) throws Exception
- Throws:
Exception
-
EmailMessage
public EmailMessage(ItemAttachment parentAttachment) throws Exception
Initializes a new instance of the "EmailMessage" class.- Parameters:
parentAttachment- The parent attachment.- Throws:
Exception- the exception
-
-
Method Detail
-
bind
public static EmailMessage bind(ExchangeService service, ItemId id, PropertySet propertySet) throws Exception
Binds to an existing e-mail message and loads the specified set of property.Calling this method results in a call to EWS.- Parameters:
service- the serviceid- the idpropertySet- the property set- Returns:
- An EmailMessage instance representing the e-mail message corresponding to the specified Id
- Throws:
Exception- the exception
-
bind
public static EmailMessage bind(ExchangeService service, ItemId id) throws Exception
Binds to an existing e-mail message and loads its first class property.Calling this method results in a call to EWS.- Parameters:
service- the serviceid- the id- Returns:
- An EmailMessage instance representing the e-mail message corresponding to the specified Id
- Throws:
Exception- the exception
-
getSchema
public ServiceObjectSchema getSchema()
Method to return the schema associated with this type of object.
-
getMinimumRequiredServerVersion
public ExchangeVersion getMinimumRequiredServerVersion()
Gets the minimum required server version.- Overrides:
getMinimumRequiredServerVersionin classItem- Returns:
- Earliest Exchange version in which this service object type is supported.
-
createReply
public ResponseMessage createReply(boolean replyAll) throws 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:
Exception- the exception
-
createForward
public ResponseMessage createForward() throws Exception
Creates a forward response to the message.- Returns:
- A ResponseMessage representing the forward response that can subsequently be modified and sent.
- Throws:
Exception- the exception
-
reply
public void reply(MessageBody bodyPrefix, boolean replyAll) throws Exception
Replies to the message. Calling this method results in a call to EWS.- Parameters:
bodyPrefix- the body prefixreplyAll- the reply all- Throws:
Exception- the exception
-
forward
public void forward(MessageBody bodyPrefix, EmailAddress... toRecipients) throws Exception
Forwards the message. Calling this method results in a call to EWS.- Parameters:
bodyPrefix- the body prefixtoRecipients- the to recipients- Throws:
Exception- the exception
-
forward
public void forward(MessageBody bodyPrefix, Iterable<EmailAddress> toRecipients) throws Exception
Forwards the message. Calling this method results in a call to EWS.- Parameters:
bodyPrefix- the body prefixtoRecipients- the to recipients- Throws:
Exception- the exception
-
send
public void send() throws Exception
Sends this e-mail message. Calling this method results in at least one call to EWS.- Throws:
Exception- the exception
-
sendAndSaveCopy
public void sendAndSaveCopy(FolderId destinationFolderId) throws 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:
Exception- the exception
-
sendAndSaveCopy
public void sendAndSaveCopy(WellKnownFolderName destinationFolderName) throws 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:
Exception- the exception
-
sendAndSaveCopy
public void sendAndSaveCopy() throws 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:
Exception- the exception
-
suppressReadReceipt
public void suppressReadReceipt() throws Exception
Suppresses the read receipt on the message. Calling this method results in a call to EWS.- Throws:
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 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 Exception
Sets the from.- Parameters:
value- the new from- Throws:
Exception- the exception
-
getIsAssociated
public boolean getIsAssociated() throws ServiceLocalException
Gets a value indicating whether this is an associated message.- Overrides:
getIsAssociatedin classItem- Returns:
- the checks if is associated
- Throws:
ServiceLocalException- the service local exception
-
setIsAssociated
public void setIsAssociated(boolean value) throws Exception
Sets the checks if is associated.- Parameters:
value- the new checks if is associated- Throws:
Exception- the exception
-
getIsDeliveryReceiptRequested
public 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(Boolean value) throws Exception
Sets the checks if is delivery receipt requested.- Parameters:
value- the new checks if is delivery receipt requested- Throws:
Exception- the exception
-
getIsRead
public 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(Boolean value) throws Exception
Sets the checks if is read.- Parameters:
value- the new checks if is read- Throws:
Exception- the exception
-
getIsReadReceiptRequested
public 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(Boolean value) throws Exception
Sets the checks if is read receipt requested.- Parameters:
value- the new checks if is read receipt requested- Throws:
Exception- the exception
-
getIsResponseRequested
public 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(Boolean value) throws Exception
Sets the checks if is response requested.- Parameters:
value- the new checks if is response requested- Throws:
Exception- the exception
-
getInternetMessageId
public 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 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(String value) throws Exception
Sets the references.- Parameters:
value- the new references- Throws:
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 Exception
Sets the sender.- Parameters:
value- the new sender- Throws:
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
-
-