Home > Net >  How to uniquely identify Mail Objects in Outlook using VBA across multiple email-IDs
How to uniquely identify Mail Objects in Outlook using VBA across multiple email-IDs

Time:01-26

I am trying to write some code that keeps a database of all the email communcation by team members to different clients.

MailItem.EntryID changes when emails are shifted between folders, hence Ive chosen to use PR_Search_Key instead.

If 4 members of my team receive an email from the client, I will have a seperate excel sheet with each team member that updates the list of emails received by each of them. And all 4 excel sheets will be collated with the team lead.

Now I need a way to only collate one entry of each email even if 4 people have been marked as recipients. Will PR Search key be optimal in this situation.

CodePudding user response:

Use PR_INTERNET_MESSAGE_ID (0x1035001F) instead - it will be the same on copies of the message in all mailboxes.

CodePudding user response:

There is no best work-for-all solution. I will try to cover the most widely used solutions:

  1. Like Dmitry suggested the PR_INTERNET_MESSAGE_ID property is UID of the email. However, you need to keep in mind that the internet message IDs are set on the outside emails. The property may be missed if an email is traveling inside the same org (Exchange server).

  2. The Search Keys are also ideal for that. However, the final implementation depends on the service provider. The search key of a message is a unique identifier of the message's data. Message store providers furnish a message's PR_SEARCH_KEY property at message creation time. The search key of an address book entry is computed from its address type (PR_ADDRTYPE) and address (PR_EMAIL_ADDRESS). I didn't find any problems with using search keys.

  3. Create your own solution for generating IDs based on the email's data.

  •  Tags:  
  • Related