HrProcessConvActionForSentItem
[This is now documented here: https://msdn.microsoft.com/en-us/library/ff976788.aspx]
If you’re like me, you spend your time using Depends to see what kinds of new and exciting functions are exported every time there’s a new release of Outlook. Ok – so I don’t really do that, but development did ask me to document one of those functions. Here we go:
HrProcessConvActionForSentItem
Performs post-send categorization on a mail item based on its PidTagConversationId.
Exported by: |
outlook.exe |
Called by: | Client |
Implemented by: | Outlook |
HRESULT WINAPI HrProcessConvActionForSentItem( SBinary const *pmbinStoreEid, SBinary const *pmbinMsgEid, SBinary const *pmbinConvID, DWORD dwFlags) |
Parameters
pmbinStoreEid
[in] The PidTagEntryId of the store (or the PidTagStoreEntryId of the mail item). Cannot be NULL or invalid.
pmbinMsgEid
[in] The PidTagEntryId of the mail item. Cannot be NULL or invalid.
pmbinConvID
[in] The PidTagConversationId of the mail item. Cannot be NULL or invalid.
dwFlags
[in] A bitmask of the following flags (recommend value is 0). Unknown flags will result in E_INVALIDARG. The following flag can be set:
PCAFSIF_MSGEID_IS_SEARCH_KEY (0x00000001) – The pmbinMsgEid argument is actually the PidTagSearchKey of the message. This is more expensive and should be avoided if a PidTagEntryId is available.
Return Value
S_OK on success, or a FAILED HRESULT on failure
Remarks
Categories are considered personal information and should not be transmitted outside the user’s mailbox. This function should be called on the Sent Item copy (or equivalent) of the mail item only after the mail item has been sent.
This function can only be called in process with Outlook.exe, such as from a COM Add-In. Attempts to call this function out of process will cause an access violation exception.
[update: 8/23/2010] Got confirmation from dev that this function is in-proc only after my attempt to add it to MFCMAPI caused a crash.
Comments
Anonymous
September 03, 2010
Is there a way to force Conversation Actions to get applied to incoming mail messages? I am implementing a custom MAPI store (wrapped PST) and am unable to get the conversation actions to run automatically on incoming mail.Anonymous
September 03, 2010
Sure - just run it. You're the store provider - run HrProcessConvActionForSentItem on the incoming messages.Anonymous
September 03, 2010
Thanks! So i notice that there are two methods being exported from Outlook.exe: HrProcessConvActionForSentItem@16 and HrProcessConvActionForSentItem Which one should be used? Also I tried them both but unfortunately the conversation action did not get applied to the incomming message. Here is what I did:
- Created new message in store and set the properties PidTagConversationIndex and PidTagConversationIndexTracking on it.
- Called SaveChanges() on the message (using the KEEP_OPEN_READWRITE flag).
- Called HrProcessConvActionForSentItem() on the message. Is this enough for do I need to do any extra steps?
Anonymous
September 03, 2010
Use the one without the @. I didn't get a chance to test this function out and see exactly what it does. The documentation indicates that it applies to sent items, not received, so maybe that's why you're not seeing any changes.Anonymous
September 09, 2010
Looks like I was not using the correct value for PidTagConversationId. The method works for conversation action of type 'Add Category'. That said the code does NOT seem to work for the 'Ignore' or 'Move to folder' conversation actions.