How to uniquely identify an Outlook email as MailItem.EntryID changes when email is moved

后端 未结 3 891
忘了有多久
忘了有多久 2021-01-14 08:38

My company uses a single email address for customers to send requests and orders to. we created an Access database that import emails into a table. The table creates it\'s o

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-14 09:27

    You can use the PR_SEARCH_KEY property (DASL name http://schemas.microsoft.com/mapi/proptag/0x300B0102) - it does not change when a message is moved. It can be accessed through MailItem.PropertyAccessor.GetProperty, but unfortunately you cannot use PT_BINARY properties in Items.Find/Restrict.

    You can also set your own named property using MailItem.UserProperties.

    UPDATE:

    For PR_SEARCH_KEY, see https://msdn.microsoft.com/en-us/library/office/cc815908.aspx.

    MaillItem.UserProperties can be used from anywhere - Outlook Object Model is Outlook Object Model whether it is used from inside Outlook or externally from Excel. Keep in mind that setting a user property and daving the item will change its last modified date.

    If you want to stick to PR_SEARCH_KEY, to be be able to sort on it, you might want to look at Redemption - its RDOFolder.Items.Find / Restrict methods allow PT_BINARY properties in its queries, e.g. "http://schemas.microsoft.com/mapi/proptag/0x300B0102" = '89F75D48972B384EB2C50266D1541099'

提交回复
热议问题