Operations on messages. More...
#include <libmapi/libmapi.h>
Functions | |
_PUBLIC_ enum MAPISTATUS | AbortSubmit (mapi_object_t *obj_store, mapi_object_t *obj_folder, mapi_object_t *obj_message) |
_PUBLIC_ enum MAPISTATUS | CreateAttach (mapi_object_t *obj_message, mapi_object_t *obj_attach) |
_PUBLIC_ enum MAPISTATUS | DeleteAttach (mapi_object_t *obj_message, uint32_t AttachmentID) |
_PUBLIC_ enum MAPISTATUS | GetAttachmentTable (mapi_object_t *obj_message, mapi_object_t *obj_table) |
_PUBLIC_ enum MAPISTATUS | GetRecipientTable (mapi_object_t *obj_message, struct SRowSet *SRowSet, struct SPropTagArray *SPropTagArray) |
_PUBLIC_ enum MAPISTATUS | GetValidAttach (mapi_object_t *obj_message, uint16_t *NumAttachments, uint32_t **AttachmentIds) |
uint8_t | mapi_recipients_get_org_length (struct mapi_profile *profile) |
uint16_t | mapi_recipients_RecipientFlags (struct SRow *aRow) |
/details RecipientFlags bitmask calculation for RecipientRows structure. | |
_PUBLIC_ enum MAPISTATUS | ModifyRecipients (mapi_object_t *obj_message, struct SRowSet *SRowSet) |
_PUBLIC_ enum MAPISTATUS | OpenAttach (mapi_object_t *obj_message, uint32_t AttachmentID, mapi_object_t *obj_attach) |
_PUBLIC_ enum MAPISTATUS | OpenEmbeddedMessage (mapi_object_t *obj_attach, mapi_object_t *obj_embeddedmsg, enum OpenEmbeddedMessage_OpenModeFlags ulFlags) |
_PUBLIC_ enum MAPISTATUS | ReadRecipients (mapi_object_t *obj_message, uint32_t RowId, uint8_t *RowCount, struct ReadRecipientRow **RecipientRows) |
_PUBLIC_ enum MAPISTATUS | RemoveAllRecipients (mapi_object_t *obj_message) |
_PUBLIC_ enum MAPISTATUS | SaveChangesMessage (mapi_object_t *parent, mapi_object_t *obj_message, uint8_t SaveFlags) |
_PUBLIC_ enum MAPISTATUS | SetMessageReadFlag (mapi_object_t *obj_folder, mapi_object_t *obj_child, uint8_t flags) |
_PUBLIC_ enum MAPISTATUS | SetRecipientType (struct SRow *aRow, enum ulRecipClass RecipClass) |
_PUBLIC_ enum MAPISTATUS | SubmitMessage (mapi_object_t *obj_message) |
_PUBLIC_ enum MAPISTATUS | TransportSend (mapi_object_t *obj_message, struct mapi_SPropValue_array *lpProps) |
Operations on messages.
_PUBLIC_ enum MAPISTATUS AbortSubmit | ( | mapi_object_t * | obj_store, | |
mapi_object_t * | obj_folder, | |||
mapi_object_t * | obj_message | |||
) |
Aborts a previous message submission.
obj_store | the store object | |
obj_folder | the folder object where the message has been submitted | |
obj_message | the submitted message object |
References mapi_provider::ctx, mapi_session::emsmdb, emsmdb_transaction(), global_mapi_ctx, mapi_object_get_handle(), mapi_object_get_id(), mapi_object_get_logon_id(), mapi_object_get_session(), OPENCHANGE_CHECK_NOTIFICATION, and OPENCHANGE_RETVAL_IF.
_PUBLIC_ enum MAPISTATUS CreateAttach | ( | mapi_object_t * | obj_message, | |
mapi_object_t * | obj_attach | |||
) |
Create a new attachment
This function creates a new attachment to an existing message.
obj_message | the message to attach to | |
obj_attach | the attachment |
Both objects need to exist before you call this message. obj_message should be a valid message on the server. obj_attach needs to be initialised.
enum MAPISTATUS retval; mapi_object_t obj_message; mapi_object_t obj_attach; ... open or create the obj_message ... mapi_object_init(&obj_attach); retval = CreateAttach(&obj_message, &obj_attach); ... check the return value ... ... use SetProps() to set the attachment up ... ... perhaps OpenStream() / WriteStream() / CommitStream() on obj_attach ... // Save the changes to the attachment and then the message retval = SaveChangesAttachment(&obj_message, &obj_attach, KeepOpenReadOnly); ... check the return value ... retval = SaveChangesMessage(&obj_folder, &obj_message, KeepOpenReadOnly); ... check the return value ...
References mapi_provider::ctx, mapi_session::emsmdb, emsmdb_transaction(), global_mapi_ctx, mapi_object_get_handle(), mapi_object_get_logon_id(), mapi_object_get_session(), mapi_object_set_handle(), mapi_object_set_logon_id(), mapi_object_set_session(), OPENCHANGE_CHECK_NOTIFICATION, and OPENCHANGE_RETVAL_IF.
_PUBLIC_ enum MAPISTATUS DeleteAttach | ( | mapi_object_t * | obj_message, | |
uint32_t | AttachmentID | |||
) |
Delete an attachment from a message
This function deletes one attachment from a message. The attachment to be deleted is specified by its PR_ATTACH_NUM
obj_message | the message to operate on | |
AttachmentID | the attachment number |
References mapi_provider::ctx, mapi_session::emsmdb, emsmdb_transaction(), global_mapi_ctx, mapi_object_get_handle(), mapi_object_get_logon_id(), mapi_object_get_session(), OPENCHANGE_CHECK_NOTIFICATION, and OPENCHANGE_RETVAL_IF.
_PUBLIC_ enum MAPISTATUS GetAttachmentTable | ( | mapi_object_t * | obj_message, | |
mapi_object_t * | obj_table | |||
) |
Retrieve the attachment table for a message
obj_message | the message | |
obj_table | the attachment table for the message |
References mapi_provider::ctx, mapi_session::emsmdb, emsmdb_transaction(), global_mapi_ctx, mapi_object_get_handle(), mapi_object_get_logon_id(), mapi_object_get_session(), mapi_object_set_handle(), mapi_object_set_logon_id(), mapi_object_set_session(), OPENCHANGE_CHECK_NOTIFICATION, and OPENCHANGE_RETVAL_IF.
_PUBLIC_ enum MAPISTATUS GetRecipientTable | ( | mapi_object_t * | obj_message, | |
struct SRowSet * | SRowSet, | |||
struct SPropTagArray * | SPropTagArray | |||
) |
Returns the message recipient table
obj_message | the message to receive recipients from | |
SRowSet | pointer to the recipient table | |
SPropTagArray | pointer to the array of properties listed in the recipient table |
References OPENCHANGE_RETVAL_IF, mapi_object::private_data, mapi_obj_message::SPropTagArray, and mapi_obj_message::SRowSet.
_PUBLIC_ enum MAPISTATUS GetValidAttach | ( | mapi_object_t * | obj_message, | |
uint16_t * | NumAttachments, | |||
uint32_t ** | AttachmentIds | |||
) |
Get the valid attachment IDs for a message
This function returns the list of valid attachment IDs for a message. You can then use these IDs with the OpenAttach and DeleteAttach functions.
obj_message | the message to operate on | |
NumAttachments | the number of attachments for the message | |
AttachmentIds | array of attachment Ids |
The AttachmentIds array has NumAttachments elements.
References mapi_provider::ctx, mapi_session::emsmdb, emsmdb_transaction(), global_mapi_ctx, mapi_object_get_handle(), mapi_object_get_logon_id(), mapi_object_get_session(), OPENCHANGE_CHECK_NOTIFICATION, and OPENCHANGE_RETVAL_IF.
uint8_t mapi_recipients_get_org_length | ( | struct mapi_profile * | profile | ) |
References mapi_profile::mailbox, and mapi_profile::username.
uint16_t mapi_recipients_RecipientFlags | ( | struct SRow * | aRow | ) |
/details RecipientFlags bitmask calculation for RecipientRows structure.
aRow | pointer to the SRow structures with the properties to pass to ModifyRecipients. |
According to MS-OXCDATA 2.9.3.1 RecipientFlags structure, the bitmask can be represented as the following:
0 3 4 5 6 7 8 9 10 11 15 16 +------+---+---+---+---+---+---+---+---+----------+---+ | Type | E | D | T | S | R | N | U | I | Reserved | O | +------+---+---+---+---+---+---+---+---+----------+---+
Type: (0x7 mask) 3-bit enumeration describing the Address Type (PR_ADDRTYPE) E: (0x8) Email address included (PR_SMTP_ADDRESS) D: (0x10) Display Name included (PR_DISPLAY_NAME) T: (0x20) Transmittable Display Name included (PR_TRANSMITTABLE_DISPLAY_NAME) S: (0x40) If Transmittable Display Name is the same than Display Name (D == T) R: (0x80) Different transport is responsible for delivery N: (0x100) Recipient does not support receiving Rich Text messages U: (0x200) If we are using Unicode properties I: (0x400) If Simple Display Name is included (PR_7BIT_DISPLAY_NAME) Reserved: Must be zero O: (0x8000) Non-standard address type is used
The PidTag property to bitmask mapping was unclear for some fields. mapiproxy between Outlook 2003 and Exchange 2010 has been used for this purpose.
For further information about PidTagAddressType, refer to [MS-OXCMAIL] section 2.1.1.9
References get_SPropValue_SRow(), PR_7BIT_DISPLAY_NAME, PR_7BIT_DISPLAY_NAME_UNICODE, PR_ADDRTYPE, PR_ADDRTYPE_UNICODE, PR_DISPLAY_NAME, PR_DISPLAY_NAME_UNICODE, PR_SEND_RICH_INFO, PR_SMTP_ADDRESS, PR_SMTP_ADDRESS_UNICODE, PR_TRANSMITTABLE_DISPLAY_NAME, and PR_TRANSMITTABLE_DISPLAY_NAME_UNICODE.
Referenced by ModifyRecipients().
_PUBLIC_ enum MAPISTATUS ModifyRecipients | ( | mapi_object_t * | obj_message, | |
struct SRowSet * | SRowSet | |||
) |
Adds, deletes or modifies message recipients
obj_message | the message to change the recipients for | |
SRowSet | the recipients to add |
References cast_mapi_SPropValue(), mapi_provider::ctx, mapi_session::emsmdb, emsmdb_transaction(), find_SPropValue_data(), get_MAPITAGS_SRow(), global_mapi_ctx, mapi_object_get_handle(), mapi_object_get_logon_id(), mapi_object_get_session(), mapi_recipients_RecipientFlags(), MAPITAGS_delete_entries(), OPENCHANGE_CHECK_NOTIFICATION, OPENCHANGE_RETVAL_IF, PR_7BIT_DISPLAY_NAME, PR_7BIT_DISPLAY_NAME_UNICODE, PR_ADDRTYPE, PR_ADDRTYPE_ERROR, PR_ADDRTYPE_UNICODE, PR_DISPLAY_NAME, PR_DISPLAY_NAME_ERROR, PR_DISPLAY_NAME_UNICODE, PR_EMAIL_ADDRESS, PR_EMAIL_ADDRESS_UNICODE, PR_ENTRYID, PR_GIVEN_NAME, PR_GIVEN_NAME_ERROR, PR_GIVEN_NAME_UNICODE, PR_RECIPIENT_TYPE, PR_SEND_INTERNET_ENCODING, PR_SEND_INTERNET_ENCODING_ERROR, PR_SMTP_ADDRESS, PR_SMTP_ADDRESS_UNICODE, PR_TRANSMITTABLE_DISPLAY_NAME, and PR_TRANSMITTABLE_DISPLAY_NAME_UNICODE.
_PUBLIC_ enum MAPISTATUS OpenAttach | ( | mapi_object_t * | obj_message, | |
uint32_t | AttachmentID, | |||
mapi_object_t * | obj_attach | |||
) |
Open an attachment to a message
This function opens one attachment from a message. The attachment to be opened is specified by its PR_ATTACH_NUM.
obj_message | the message to operate on | |
AttachmentID | the attachment number | |
obj_attach | the resulting attachment object |
References mapi_provider::ctx, mapi_session::emsmdb, emsmdb_transaction(), global_mapi_ctx, mapi_object_get_handle(), mapi_object_get_logon_id(), mapi_object_get_session(), mapi_object_set_handle(), mapi_object_set_logon_id(), mapi_object_set_session(), OPENCHANGE_CHECK_NOTIFICATION, and OPENCHANGE_RETVAL_IF.
_PUBLIC_ enum MAPISTATUS OpenEmbeddedMessage | ( | mapi_object_t * | obj_attach, | |
mapi_object_t * | obj_embeddedmsg, | |||
enum OpenEmbeddedMessage_OpenModeFlags | ulFlags | |||
) |
Opens an embedded message object and retrieves a MAPI object that can be used to get or set properties on the embedded message.
This function essentially takes an attachment and gives you back a message.
obj_attach | the attachment object | |
obj_embeddedmsg | the embedded message | |
ulFlags | access rights on the embedded message |
Possible ulFlags values:
... assume we have a message - obj_message ... // Initialise the attachment object mapi_object_init(&obj_attach); // Create an attachment to the message retval = CreateAttach(&obj_message, &obj_attach); ... check the return value ... // use SetProps() to set the attachment up, noting the special PR_ATTACHM_METHOD property attach[0].ulPropTag = PR_ATTACH_METHOD; attach[0].value.l = ATTACH_EMBEDDED_MSG; attach[1].ulPropTag = PR_RENDERING_POSITION; attach[1].value.l = 0; retval = SetProps(&obj_attach, attach, 2); ... check the return value ... // Initialise the embedded message object mapi_object_init(&obj_embeddedmsg); retval = OpenEmbeddedMessage(&obj_attach, &obj_embeddedmsg, MAPI_CREATE); ... check the return value ... // Fill in the embedded message properties, just like any other message (e.g. resulting from CreateMessage()) // Save the changes to the embedded message retval = SaveChangesMessage(&obj_message, &obj_embeddedmsg, KeepOpenReadOnly); ... check the return value ... // Save the changes to the attachment retval = SaveChangesAttachment(&obj_message, &obj_attach, KeepOpenReadOnly); ... check the return value ... // Save the changes to the original message retval = SaveChangesMessage(&obj_folder, &obj_message, KeepOpenReadOnly); ... check the return value ...
References mapi_provider::ctx, mapi_obj_message::cValues, mapi_session::emsmdb, emsmdb_get_SRow(), emsmdb_transaction(), global_mapi_ctx, mapi_ctx::lp_ctx, mapi_object_get_handle(), mapi_object_get_logon_id(), mapi_object_get_session(), mapi_object_set_handle(), mapi_object_set_logon_id(), mapi_object_set_session(), OPENCHANGE_CHECK_NOTIFICATION, OPENCHANGE_RETVAL_IF, PR_INTERNET_CPID, PR_RECIPIENT_TYPE, mapi_object::private_data, SPropTagArray_add(), SRow_addprop(), and mapi_obj_message::SRowSet.
_PUBLIC_ enum MAPISTATUS ReadRecipients | ( | mapi_object_t * | obj_message, | |
uint32_t | RowId, | |||
uint8_t * | RowCount, | |||
struct ReadRecipientRow ** | RecipientRows | |||
) |
Read Recipients from a message
obj_message | the message we want to read recipients from | |
RowId | the row index we start reading recipients from | |
RowCount | pointer on the number of recipients | |
RecipientRows | pointer on the recipients array |
References mapi_provider::ctx, mapi_session::emsmdb, emsmdb_transaction(), global_mapi_ctx, mapi_object_get_handle(), mapi_object_get_logon_id(), mapi_object_get_session(), OPENCHANGE_CHECK_NOTIFICATION, and OPENCHANGE_RETVAL_IF.
_PUBLIC_ enum MAPISTATUS RemoveAllRecipients | ( | mapi_object_t * | obj_message | ) |
Deletes all recipients from a message
obj_message | the message we want to remove all recipients from |
References mapi_provider::ctx, mapi_session::emsmdb, emsmdb_transaction(), global_mapi_ctx, mapi_object_get_handle(), mapi_object_get_logon_id(), mapi_object_get_session(), OPENCHANGE_CHECK_NOTIFICATION, and OPENCHANGE_RETVAL_IF.
_PUBLIC_ enum MAPISTATUS SaveChangesMessage | ( | mapi_object_t * | parent, | |
mapi_object_t * | obj_message, | |||
uint8_t | SaveFlags | |||
) |
Saves all changes to the message
parent | the parent object for the message | |
obj_message | the message to save | |
SaveFlags | specify how the save operation behaves |
Possible value for SaveFlags:
References mapi_provider::ctx, mapi_session::emsmdb, emsmdb_transaction(), global_mapi_ctx, mapi_object_get_handle(), mapi_object_get_logon_id(), mapi_object_get_session(), mapi_object_set_id(), OPENCHANGE_CHECK_NOTIFICATION, and OPENCHANGE_RETVAL_IF.
_PUBLIC_ enum MAPISTATUS SetMessageReadFlag | ( | mapi_object_t * | obj_folder, | |
mapi_object_t * | obj_child, | |||
uint8_t | flags | |||
) |
Clear or set the MSGFLAG_READ flag for a given message
This function clears or sets the MSGFLAG_READ flag in the PR_MESSAGE_FLAGS property of a given message.
obj_folder | the folder to operate in | |
obj_child | the message to set flags on | |
flags | the new flags (MSGFLAG_READ) value |
References mapi_provider::ctx, mapi_session::emsmdb, emsmdb_transaction(), global_mapi_ctx, mapi_object_get_handle(), mapi_object_get_logon_id(), mapi_object_get_session(), OPENCHANGE_CHECK_NOTIFICATION, and OPENCHANGE_RETVAL_IF.
_PUBLIC_ enum MAPISTATUS SetRecipientType | ( | struct SRow * | aRow, | |
enum ulRecipClass | RecipClass | |||
) |
Set the type of a recipient
The function sets the recipient type (RecipClass) in the aRow parameter. ResolveNames should be used to fill the SRow structure.
aRow | the row to set | |
RecipClass | the type of recipient to set on the specified row |
References OPENCHANGE_RETVAL_IF, PR_RECIPIENT_TYPE, and SRow_addprop().
_PUBLIC_ enum MAPISTATUS SubmitMessage | ( | mapi_object_t * | obj_message | ) |
Saves all changes to the message and marks it as ready for sending.
This function saves all changes made to a message and marks it ready to be sent.
obj_message | the message to mark complete |
References mapi_provider::ctx, mapi_session::emsmdb, emsmdb_transaction(), global_mapi_ctx, mapi_object_get_handle(), mapi_object_get_logon_id(), mapi_object_get_session(), OPENCHANGE_CHECK_NOTIFICATION, and OPENCHANGE_RETVAL_IF.
_PUBLIC_ enum MAPISTATUS TransportSend | ( | mapi_object_t * | obj_message, | |
struct mapi_SPropValue_array * | lpProps | |||
) |
Sends the specified Message object out for message delivery.
References mapi_provider::ctx, mapi_session::emsmdb, emsmdb_transaction(), global_mapi_ctx, mapi_object_get_handle(), mapi_object_get_logon_id(), mapi_object_get_session(), OPENCHANGE_CHECK_NOTIFICATION, and OPENCHANGE_RETVAL_IF.
![]() ![]() ![]() |
This content is licensed under the Creative Commons Attribution ShareAlike License v. 3.0: http://creativecommons.org/licenses/by-sa/3.0/ |