0

I leave it to you because I can't find a solution on the Internet. I explain I was using a library (EaGetMail) which allowed me to manage my emails but now I had to change the library and so I chose the Outlook library.

However it is impossible for me to reproduce a result that I had with the old library.

With EagetMail I could retrieve the unique identifier of an email received in a number format type for example: 123 and each time I received a new email, it had a larger identifier than the previous email received (for instance : 131). But the problem with the Outlook library is that the unique identifier is a mixture of numbers and characters which is problematic for my algorithm. How can I retrieve the unique identifier in the same way as the EaGetMail library (C#)?

Thank you in advance ;)

Laura Destier
  • 41
  • 3
  • 11
  • Are you sure that was a unique identifier for the email and not just the email's current position in the IMAP inbox? (i.e. would change if older emails were deleted) I don't think there's an equivalent sequence number in MAPI, no. – Rup Jul 07 '20 at 14:45
  • Does this answer your question? [Get Unique Id From MailItem (Microsoft.Office.Interop.Outlook)?](https://stackoverflow.com/questions/16309295/get-unique-id-from-mailitem-microsoft-office-interop-outlook) – NajiMakhoul Jul 07 '20 at 15:43

1 Answers1

0

Outlook uses the EntryID string for identifying items uniquely. But if you need a number which is increased each time you receive new items you can add a user property, see UserProperties.Add for more information.

Sub AddUserProperty() 
 Dim myItem As Outlook.MailItem 
 Dim myUserProperty As Outlook.UserProperty 
 
 Set myItem = Application.CreateItem(olMailItem) 
 Set myUserProperty = myItem.UserProperties.Add(100, olInteger) 
 myItem.Display 
End Sub
Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45