none
Does each mail have a unique index or other else? RRS feed

  • Question

  • Hello,
    I listed some mails in datagridview control.
    Now, I will set flag icon to the mails that selected by user in datagridview.
    What is the easiest way to identify which of these selected items are the mails in Outlook?  Use EntryID or other else? Does each mail have a unique index?
    Thanks in advance!
    Wednesday, February 1, 2017 11:40 AM

Answers

  • Oh, looks like I missed the keyword...

    Leon, the Outlook object model provides the EntryID property. Note, EntryID is unique in terms of a particular store only. Moreover, the Entry ID changes when an item is moved into another store, for example, from your Inbox to a Microsoft Exchange Server public folder, or from one Personal Folders (.pst) file to another .pst file. Solutions should not depend on the EntryID property to be unique unless items will not be moved. 

    Also you may consider using the PR_SEARCH_KEY property. 


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    • Proposed as answer by Chenchen LiModerator Thursday, February 2, 2017 1:15 AM
    • Marked as answer by leon1526 Thursday, February 2, 2017 3:21 AM
    Wednesday, February 1, 2017 5:42 PM
  • EntryID is what you need. Unless your view is grouped in a such a way that the same message can be displayed in different rows (MAPI can accommodate that).

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

    • Proposed as answer by Chenchen LiModerator Thursday, February 2, 2017 1:15 AM
    • Marked as answer by leon1526 Thursday, February 2, 2017 3:21 AM
    Wednesday, February 1, 2017 5:14 PM

All replies

  • Hello Leon,

    You can use the MessageClass property for identifying item types. At least Outlook uses its value for selecting which form to show as an inspector window. Here is what MSDN states for that:

    The MessageClass property links the item to the form on which it is based. When an item is selected, Outlook uses the message class to locate the form and expose its properties, such as Reply commands.

    If we are speaking about the grid in an Outlook explorer, the icon is deployed with the form associated. So, you need to publish a form if you want to get a custom icon in the Outlook UI.


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Wednesday, February 1, 2017 1:03 PM
  • OP wants a unique property. MessageClass is far from being unique - chances are most items in any particular folder will have the same value of MessageClass (e.g. IPM.Note).

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

    Wednesday, February 1, 2017 5:13 PM
  • EntryID is what you need. Unless your view is grouped in a such a way that the same message can be displayed in different rows (MAPI can accommodate that).

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

    • Proposed as answer by Chenchen LiModerator Thursday, February 2, 2017 1:15 AM
    • Marked as answer by leon1526 Thursday, February 2, 2017 3:21 AM
    Wednesday, February 1, 2017 5:14 PM
  • Oh, looks like I missed the keyword...

    Leon, the Outlook object model provides the EntryID property. Note, EntryID is unique in terms of a particular store only. Moreover, the Entry ID changes when an item is moved into another store, for example, from your Inbox to a Microsoft Exchange Server public folder, or from one Personal Folders (.pst) file to another .pst file. Solutions should not depend on the EntryID property to be unique unless items will not be moved. 

    Also you may consider using the PR_SEARCH_KEY property. 


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    • Proposed as answer by Chenchen LiModerator Thursday, February 2, 2017 1:15 AM
    • Marked as answer by leon1526 Thursday, February 2, 2017 3:21 AM
    Wednesday, February 1, 2017 5:42 PM