Infovark Underground

  • news
    • infoblog
    • underground
  • product
  • download
  • buy
  • support
  • about
    • ← Using WCF to return HTML
    • WCF WebInvoke Body Format Error →

    An Outlook Conversation

    24 Feb 2009 by Gordon in Programming / 1 Comment

    One of the things that I had to do in Outlook this week was to determine if an outlook MailItem is part of a conversation. 

    After much googlework, I discovered  two properties on the Outlook MailItem – ConversationIndex and ConversationTopic.

    To determine if an Outlook Item is part of a Conversation, you need to look at the first 22 bytes of the hex string reported for ConversationIndex. If they are the same, then the message is part of the same conversation. 
     

    using Microsoft.Office.Interop.Outlook;      
    1.  
    2. public static bool SameConversation(MailItem item1, MailItem item2)
    3.  
    4.       {
    5.        return item1.ConversationIndex.Substring(0, 22) ==
    6.        item2.ConversationIndex.Substring(0, 22);
    7.       }

    That’s all well and good, but note that this property is somewhat unreliable. For starters, in versions of outlook prior to 2003, it returned binary data, instead of a hex string (but if you’re working with versions of Outlook prior to 2003, you probably have other problems…) The other reason this property is unreliable is because it is set by the client – Outlook appends a 5 byte timestamp to the ConversationIndex when you reply. Which is cool, as long as you reply through Outlook.

    But – our Infovark mail server is hosted by Google, and I occasionally use the gmail web client to reply to mail,  instead of Outlook. For these conversations, when the replies were eventually retrieved into Outlook via IMAP, they ended up with unique conversationindexes, and so I couldn’t identfy them as being part of the same conversation.

    In these cases, that’s where the ConversationTopic Property can help give you a clue. The ConversationTopic is the normalized subject of the message, that is, the subject without all the prefix strings (“Re:Re:” etc.) By comparing ConversationTopics, you can usually piece together the conversation, even if the ConversationIndex is not correct.

    No related posts.

    • Tweet
    • Tags:
    • C#
    • conversation
    • outlook

    1 Comment

    • Bruce

      Hello,
      Do you know of any way this can be modified? As you can imagine, it would be hugely useful…

      Thanks,
      Bruce

      12 Jun 2009 02:06 am
      Reply

      Leave a Comment

      Posting your comment...

      Subscribe to these comments via email

      • Categories

        • .NET (41)
        • AJAX (3)
        • Books (7)
        • HTML (9)
        • Infovark (8)
        • Programming (48)
        • REST (11)
        • SQL (3)
        • Testing (3)
        • Tools (13)
        • UI (3)
        • WCF (11)
        • Web Services (8)
        • WPF (4)
        • XML (4)
      • Archives

      • Get future articles


         

      • Blogroll

        • Ajaxian
        • Anne Van Kesteren
        • Brain.Save()
        • Coding Horror
        • Eric Sink
        • Joel Spolsky
        • John Resig
        • Mark Pilgrim
        • Raymond Chen
        • Scott Hansleman
        • Secret Geek
        • Steve Yegge
        • The Daily WTF
        • The Database Programmer
      • Meta

        • Log in
        • Entries RSS
        • Comments RSS
        • WordPress.org
    • Site map

      • News
      • Product
      • Download
      • Buy
      • Support
      • About
    • Recent Posts

      • Review: Brownfield Application Development in .NET
      • Using Modal Dialogs with a Splash Screen in WPF
      • Highlighting query terms in a WPF TextBlock
      • Getting XAML Hyperlink text to wrap
      • How to format the XAML Hyperlink NavigateUri
    • Twitter

      Copyright 2011 Infovark, Inc. All rights reserved.