0 votes
by (300 points)

After sending an email:

_ewsClient.SendMessage(mailMessage, ewsFolder.Id);

I would like to retrieve the EwsItemId associated to it so I can store it on our database for later use.

Applies to: Rebex Secure Mail

1 Answer

0 votes
by (3.9k points)
selected by
 
Best answer

Hello,

the EwsItemId can be obtained by saving message in drafts by calling ewsClient.StoreMessage that give you item id and then you can send the message giving as parameter the EwsItemId. Here is the code:

// Get EwsItemId
var ItemId = ewsClient.StoreMessage(EwsFolderId.Drafts, message);

// store EwsItemId in database
...

// Send message
ewsClient.SendMessage(ItemId);
...