Client applications typically support two types of replies: one that is sent only to the sender of the original message and one that is sent to all other recipients included in the recipient list of the original message in addition to the sender. This second type of reply is commonly referred to as a reply all message.
To send a reply of either type, you implement some of the same tasks that you would when you send an original message. For example, you open the default message store and the outgoing message folder, typically the Outbox, and call the outgoing folder's IMAPIFolder::CreateMessage method to create the reply. Also, you open the folder that holds the original message, typically the Inbox. For information about opening different folders, see Opening a Folder.
The main difference between creating a reply and creating an original message is that with a reply, most of the properties are either based on or copied directly from properties of the original message. Attachments — a message's PR_MESSAGE_ATTACHMENTS property — are specifically excluded. The recipient list for a reply all message is created from the original message's list with the recipient represented by the PR_RECEIVED_BY_SEARCH_KEY property and all blind carbon copy recipients removed. The PR_RECEIVED_BY_SEARCH_KEY property represents the current user.
Set a prefix for the reply. If you are using the standard "RE:", concatenate these characters onto the beginning of PR_NORMALIZED_SUBJECT and set PR_SUBJECT to this new string. Do not set PR_SUBJECT_PREFIX. If you are using a nonstandard prefix, such as a string longer than three characters, store it in PR_SUBJECT_PREFIX.
Set the PR_SENT_REPRESENTING properties to the corresponding values in the PR_RCVD_REPRESENTING properties.
Keep these properties synchronized. That is, PR_REPLY_RECIPIENT_ENTRIES and PR_REPLY_RECIPIENT_NAMES must contain the same number of entries, and an entry at a particular position in one of the properties must correspond to an entry at the same position in the other property.
If the reply is being sent only to the sender of the original message, create a single entry recipient list with the recipient represented by the original message's PR_SENT_REPRESENTING property. For more information about creating a recipient list, see Creating a Recipient List.
If the reply is a reply all, create a recipient list as follows:
Call HrQueryAllRows to retrieve all of the rows in the table. Determine if each row represents a primary or carbon copy recipient and should remain in the list or if it represents a blind carbon copy recipient or the user and should be removed from the list.
Differentiate between recipient types by looking at the PR_RECIPIENT_TYPE column. This column will be set to MAPI_TO for primary recipients, MAPI_CC for carbon copy recipients, and MAPI_BCC for blind carbon copy recipients.
Remove unwanted rows from the recipient list by calling MAPIFreeBuffer to free the memory associated with the corresponding entries in the recipient table's SRowSet structure. Set all of the values in the property value array to zero, all of the cValues members to zero, and all of the lpProps members in each SRow structure in the SRowSet to NULL.
Call the reply message'sIMessage::ModifyRecipientsmethod, setting the ulFlags parameter to zero, to create a new recipient list for the reply or forwarded message based on the list from the original message.
Note Before calling IMessage::ModifyRecipients to store changes in the recipient list, you can allow users to make modifications through the message form. Users can add to the list or remove particular members. Allowing users to make changes to a recipient list is an optional client feature.