Accessing Messages in the MTS-IN and MTS-OUT Folders
To put incoming messages into the MTS-IN folder, you need to call the following MAPI methods:
-
IMAPIFolder::CreateMessage, to create a new MAPI message that will hold the data from the incoming message.
-
IMessage::CreateAttach, to hold any attachments on the incoming message.
-
IMAPIProp::OpenProperty, to open various message properties that your gateway will need to modify.
-
IMAPIProp::SetProps, to modify one or more property values.
-
IMessage::ModifyRecipients, to modify the recipient list on the new MAPI message.
-
IMAPIProp::SaveChanges, to make the above changes permanent in the new message.
-
IMessage::SubmitMessage, to save the message to the folder and mark it as ready to be delivered.
To read outgoing messages from the MTS-OUT folder, you need to call the IMAPIFolder::GetContentsTable, to access the table of messages (MTEs) present in the folder.
-
IMAPITable::QueryRows (or the Microsoft Exchange Server function HrQueryAllRows), to retrieve one or more rows from the table.
-
IMAPIContainer::OpenEntry, to access a particular MTE in the folder.
-
IMessage::GetRecipientTable, to find out what addresses the message attached to the MTE should be delivered to.
-
IMessage::GetAttachmentTable, to find the message attached to the MTE.
-
IMAPIProp::GetProps, to read the subject, message class, contents, etc., of the outgoing message.
For details about these functions, see the MAPI Programmer’s Reference. For examples of calling these functions, see the sample code for GWSAMPLE.C in the \BKOFFICE\SAMPLES\EXCHANGE\GWSAMPLE directory.