yoxhall
yoxhall

Reputation: 42

How can i find the permanent id of an email in EWS managed API?

I am building an application that filters through all the emails in a user's mailbox and then moves the results in a Quarantine folder for further review. However, when moving, the original item(email) is deleted and a new item is created with a new ItemId. I have read the documentation but i could not find anything mentioning about a permanent id that doesn't change when moving/copying.

Is there a way to set the id manually? I looked into AlternateID and it looks like it might be one solution.

I use EWS Managed API(.NET Framework) in Exchange 2019.

Upvotes: 0

Views: 778

Answers (2)

Glen Scales
Glen Scales

Reputation: 22032

EWS doesn't have an immutableId for messages so when a message moves between folders it will change. You can use the InternetMessageId which won't change when a message is moved but it's not guaranteed to be unique. PidTagSearchKey is another one https://learn.microsoft.com/en-us/office/client-developer/outlook/mapi/pidtagsearchkey-canonical-property this should be globally unique and won't change when you move an Item between folder. The change you need to make however is that you now need to search for the messages based on one of these Id's you won't be able to bind to the item directly as in the case of the ewsId.

Upvotes: 1

Fidelity Pension
Fidelity Pension

Reputation: 1

You can't find the permanent ID for an EWS-managed email. But you can grant access to the mailbox through EWS.

Example: var email = new

     Microsoft.Exchange.WebServices.Data.Email();email.Id("[email protected]");

Upvotes: 0

Related Questions