Compoze Software, Inc.

com.compoze.collab.exchange
Interface IExchangeMessage

All Superinterfaces:
IAttachmentSupport, IExchangeItem, IGroupwareItem, IItem, IMailMessage, IMessage, IMessagingItem, java.io.Serializable
All Known Subinterfaces:
IDeliveryReport, IExchangeNonDeliveryReport, IMapiTaskRequest, IMeetingCancellation, IMeetingNotice, IMeetingNoticeAccepted, IMeetingNoticeDeclined, IMeetingNoticeTentative, IMeetingRequest, ITaskNotice, ITaskRequest

public interface IExchangeMessage
extends IMailMessage, IExchangeItem

This interface is used to represent an exchange message.

This is an example of how to create a message, set properties, and send it

Sample code:

/**
 * The <code>createMessage</code> method demonstrates how to create a message
 * with either the MAPI or the WebDAV Exchange providers. The message has
 * several properties set and then is sent.
 * 
 * @throws  CollaborationException  if the session factory could not instantiate
 *          a session with the given parameters, or if there was an error
 *          retrieving folders, setting properties, or sending a message.
 */
public  void    createMessage
(
)
throws  CollaborationException
    {
    // setup the session
    Properties p = new Properties ();    
    p.setProperty (IExchangeSession.PROP_PROVIDER, IWebdavSession.INTERNAL_NAME);
    p.setProperty (IExchangeSession.PROP_EXCHANGE_SERVER, "server");
    p.setProperty (IExchangeSession.PROP_USER_DOMAIN, "domain");
    p.setProperty (IExchangeSession.PROP_USER_USERNAME, "username");
    p.setProperty (IExchangeSession.PROP_USER_PASSWORD, "password");
    
    // create and open the session
    IExchangeSession session = (IExchangeSession)SessionFactory.createSession(p);   
    session.open();
    session.login ();
    
    IRootContainer root = session.getDefaultRootContainer ();
    
    // Get a handle to the drafts folder 
    IExchangeMailContainer drafts = null;
    drafts = (IExchangeMailContainer)session.getDefaultContainer( 
        DefaultContainerClassEnum.DRAFTS );
            
    // add a new item to the drafts folder, but do not commit it yet
    // the item will be of the type IExchangeMessage.CLASS
    // it is possible to use other types, such as IMailMessage.CLASS,
    // however it is always best to use the most specific type when possible 
    IExchangeMessage msg = null; 
    msg = (IExchangeMessage)drafts.add( IExchangeMessage.CLASS, false );
    
    // set the subject
    msg.setSubject( "Compoze Software Test Message" );
    
    // set the body
    // the HTML body could also be set with HTML instead
    msg.setBody( "Body of the message." );

    // set the importance to high
    msg.setImportance( ImportanceEnum.HIGH );
    
    // add a "TO" recipient     
    msg.addRecipient( RecipientTypeEnum.TO, "user@domain.com" );

    // add a "CC" recipient     
    msg.addRecipient( RecipientTypeEnum.CC, "user2@domain.com" );    
    
    // commit the msg
    // we do not have to commit before sending, but it does not hurt
    msg.commit();
    
    // send our message and save it in our sent items folder
    IContainer sentItems = null;
    sentItems = session.getDefaultContainer( DefaultContainerClassEnum.SENT );
    msg.send( sentItems );
    
    // logout and close
    session.logout ();
    session.close();
    }

Field Summary
static ItemClass CLASS
          The ItemClass that represents an Exchange mail message.
static Key DELIVERY_RECEIPT_REQUESTED
          Key that represents a delivery receipt was requested.
static int KEYID_DELIVERY_RECEIPT_REQUESTED
          The int ID for the DELIVERY_RECEIPT_REQUESTED key.
 
Fields inherited from interface com.compoze.collab.groupware.IMailMessage
DELIVERY_DATE, DISPLAY_BCC, DISPLAY_CC, DISPLAY_FROM, DISPLAY_TO, ENCRYPTED, KEYID_DELIVERY_DATE, KEYID_DISPLAY_BCC, KEYID_DISPLAY_CC, KEYID_DISPLAY_FROM, KEYID_DISPLAY_TO, KEYID_ENCRYPTED, KEYID_READ_RECEIPT_REQUESTED, KEYID_SENDER_ADDRESS, KEYID_SENDER_NAME, KEYID_SENT_DATE, KEYID_SIGNED, KEYID_UNREAD, READ_RECEIPT_REQUESTED, SENDER_ADDRESS, SENDER_NAME, SENT_DATE, SIGNED, UNREAD
 
Fields inherited from interface com.compoze.collab.messaging.IMessage
KEYID_RECIPIENTS, RECIPIENTS
 
Fields inherited from interface com.compoze.collab.messaging.IMessagingItem
BODY, BODY_HTML, KEYID_BODY, KEYID_BODY_HTML
 
Fields inherited from interface com.compoze.collab.IItem
ID, ITEM_CLASS, KEYID_ID, KEYID_ITEM_CLASS, KEYID_PARENT_ID, MINIMUM_ITEM_KEYS, PARENT_ID
 
Fields inherited from interface com.compoze.collab.groupware.IGroupwareItem
CATEGORIES, DATE_CREATED, DATE_LAST_MODIFIED, IMPORTANCE, KEYID_CATEGORIES, KEYID_DATE_CREATED, KEYID_DATE_LAST_MODIFIED, KEYID_IMPORTANCE, KEYID_SIZE, KEYID_SUBJECT, SIZE, SUBJECT
 
Fields inherited from interface com.compoze.collab.exchange.IExchangeItem
BODY_RTF, CONTACT_NAMES, CREATOR_ENTRYID, FLAG, FLAG_REMIND_BY, FLAG_TEXT, HAS_REMINDER, HIDE_ATTACHMENTS, ICON_INDEX, IS_HIDDEN, KEYID_BODY_RTF, KEYID_CONTACT_NAMES, KEYID_CREATOR_ENTRYID, KEYID_FLAG, KEYID_FLAG_REMIND_BY, KEYID_FLAG_TEXT, KEYID_HAS_REMINDER, KEYID_HIDE_ATTACHMENTS, KEYID_ICON_INDEX, KEYID_IS_HIDDEN, KEYID_MILEAGE, KEYID_NORMALIZED_SUBJECT, KEYID_PRIORITY, KEYID_SENSITIVITY, KEYID_SUBJECT_PREFIX, MILEAGE, NORMALIZED_SUBJECT, PRIORITY, SENSITIVITY, SUBJECT_PREFIX
 
Fields inherited from interface com.compoze.collab.IAttachmentSupport
ATTACHMENTS, HAS_ATTACHMENT, KEYID_ATTACHMENTS, KEYID_HAS_ATTACHMENT
 
Method Summary
 boolean getDeliveryReceiptRequested()
          Gets the delivery receipt requested option on an Exchange message.
 void setDeliveryReceiptRequested(boolean bReceiptRequested)
          Sets the delivery receipt requested option on an Exchange message.
 
Methods inherited from interface com.compoze.collab.groupware.IMailMessage
addEmbeddedAttachment, addRecipient, addRecipient, forward, forward, getBccAddresses, getBccRecipients, getCcAddresses, getCcRecipients, getDateDelivered, getDateSent, getFromAddresses, getRecipientsByType, getSender, getToAddresses, getToRecipients, isEncrypted, isReadReceiptRequested, isSigned, isUnread, removeRecipient, removeRecipient, removeRecipient, reply, reply, send, send, setEncrypted, setReadReceiptRequested, setSigned, setUnread
 
Methods inherited from interface com.compoze.collab.messaging.IMessage
addRecipient, getRecipients, send, setRecipients
 
Methods inherited from interface com.compoze.collab.messaging.IMessagingItem
getBody, getBodyHtml, setBody, setBodyHtml
 
Methods inherited from interface com.compoze.collab.IItem
commit, containsKey, containsKey, copyProperties, copyTo, delete, fetchProperties, getAttribute, getEnum, getID, getInputStream, getItemClass, getOutputStream, getParent, getParent, getParentID, getProperties, getProperties, getProperties, getProperty, getProperty, getProperty, getReader, getRootContainer, getSession, getWriter, isMissing, moveTo, removeAttribute, removeProperty, setAttribute, setProperties, setProperty, setProperty, setProperty
 
Methods inherited from interface com.compoze.collab.groupware.IGroupwareItem
getBodyHtml, getBodyHtml, getCategories, getDateCreated, getDateLastModified, getImportance, getNormalizedSubject, getSize, getSubject, getSubject, getSubjectPrefix, setBodyHtml, setCategories, setImportance, setSubject
 
Methods inherited from interface com.compoze.collab.exchange.IExchangeItem
getBodyRtf, getContactNames, getFlagStatus, getFlagText, getHideAttachments, getMileage, getPriority, getSensitivity, getSubjectPrefix, isHidden, setBodyRtf, setContactNames, setFlagStatus, setFlagText, setHideAttachments, setMileage, setPriority, setSensitivity, setSubjectPrefix
 
Methods inherited from interface com.compoze.collab.IAttachmentSupport
addAttachment, getAttachment, getAttachmentCount, getAttachments, hasAttachment
 

Field Detail

KEYID_DELIVERY_RECEIPT_REQUESTED

public static final int KEYID_DELIVERY_RECEIPT_REQUESTED
The int ID for the DELIVERY_RECEIPT_REQUESTED key.

DELIVERY_RECEIPT_REQUESTED

public static final Key DELIVERY_RECEIPT_REQUESTED
Key that represents a delivery receipt was requested.

CLASS

public static final ItemClass CLASS
The ItemClass that represents an Exchange mail message.
Method Detail

setDeliveryReceiptRequested

public void setDeliveryReceiptRequested(boolean bReceiptRequested)
                                 throws CollaborationException
Sets the delivery receipt requested option on an Exchange message. The Exchange servers will send notification via email when the message was successfully delivered to the target mail system.
Parameters:
bReceiptRequested - if true, then notify the sender when their message is received by the target mail system. If false then no notifcation will be given (default).
See Also:
DELIVERY_RECEIPT_REQUESTED

getDeliveryReceiptRequested

public boolean getDeliveryReceiptRequested()
                                    throws CollaborationException
Gets the delivery receipt requested option on an Exchange message. return if true, then the sender wishes to be notified of when the target mail system received the message, false otherwise.
See Also:
DELIVERY_RECEIPT_REQUESTED

Compoze Software, Inc.

Copyright ©1999-2005 Compoze Software, Inc. All rights reserved.