none
Get email size and conversation index RRS feed

  • Question

  • Hi,

    I'm trying to calculate the duration that takes each email to be sent. To achieve this, I'm capturing Application.Send and Items.ItemAdd events, I need to check whether the email that was added to the Outbox is the one I'm interested in. Does conversation index change when the email is moved from Outbox to Sent Mail folder?

    Any help will be appreciated.




    • Edited by HediNaili Thursday, January 9, 2014 10:09 AM useless code deleted
    Tuesday, January 7, 2014 9:05 AM

Answers

  • Hello Hedi,

    It looks like you are interested in the Size and ConversationIndex properties of the MailItem class. You just need to cast the passed as a parameter object to the MailItem interface.

    Of course, you can try to use the ConversationIndex property which returns a String that indicates the relative position of the item within the conversation thread. But using only one property is not sufficient. You also need to use the ConversationID or ConversationTopic properties to identify the conversation. 

    Instead, you can use the following possible ways for identifying the sent items:

    1. The EntryID property of the MailItem class can be used for identifying Outlook items uniquely. Be aware, the ID may change if an item is moved between stores due to the fact that it is assigned by store providers. Also I'd like to admit that the EntryID property is not set for an Outlook item until it is saved or sent. Solutions should not depend on the EntryID property to be unique unless items will not be moved.

    2. As a workaround, you can add custom fields to Outlook items programmatically. The PropertyAccessor class can be used to get the job done (see the corresponding property of Outlook items):

    myItem.UserProperties.Add("MyPropName", olText);
    Later you can get the value using the GetProperty or GetProperties methods of the PropertyAccessor class. Note, the PropertyAccessor class was introduced with Outlook 2007.
    • Marked as answer by HediNaili Tuesday, January 7, 2014 1:17 PM
    Tuesday, January 7, 2014 12:10 PM

All replies

  • Hello Hedi,

    It looks like you are interested in the Size and ConversationIndex properties of the MailItem class. You just need to cast the passed as a parameter object to the MailItem interface.

    Of course, you can try to use the ConversationIndex property which returns a String that indicates the relative position of the item within the conversation thread. But using only one property is not sufficient. You also need to use the ConversationID or ConversationTopic properties to identify the conversation. 

    Instead, you can use the following possible ways for identifying the sent items:

    1. The EntryID property of the MailItem class can be used for identifying Outlook items uniquely. Be aware, the ID may change if an item is moved between stores due to the fact that it is assigned by store providers. Also I'd like to admit that the EntryID property is not set for an Outlook item until it is saved or sent. Solutions should not depend on the EntryID property to be unique unless items will not be moved.

    2. As a workaround, you can add custom fields to Outlook items programmatically. The PropertyAccessor class can be used to get the job done (see the corresponding property of Outlook items):

    myItem.UserProperties.Add("MyPropName", olText);
    Later you can get the value using the GetProperty or GetProperties methods of the PropertyAccessor class. Note, the PropertyAccessor class was introduced with Outlook 2007.
    • Marked as answer by HediNaili Tuesday, January 7, 2014 1:17 PM
    Tuesday, January 7, 2014 12:10 PM
  • ConversationIndex is not unique enough.

    Setting a named property in Application.ItemSend will force Outlook to send the message in the TNEF format (the infamous winmail.dat).

    Try to use the PR_SEARCH_KEY property instead- http://msdn.microsoft.com/en-us/library/office/cc815908.aspx


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Tuesday, January 7, 2014 2:05 PM
  • No answer could get better than yours.

    Thanks, Eugene.

    Regards.

    Hedi.

    Tuesday, January 7, 2014 2:42 PM
  • Hi Dimtry,

    Is there any combination of properties that is unique for each MailItem?

    Regards.

    Wednesday, January 8, 2014 9:41 AM
  • Hi Hedi,

    As I wrote above, Outlook uses the EntryID property for identifying items uniquely.

    The PR_SEARCH_KEY property is used for a search. Here is what description in MSDN states: Contains a binary-comparable key that identifies correlated objects for a search.

    Wednesday, January 8, 2014 12:33 PM