问题
VSTO: Outlook 2007 Add-In Project.
I have Sent an sampleEmail using a custom button in the Ribbon control. Now, How, can get the sampleEmail from Sent Items folder?
I tried by using the Entry ID property. but that was not helpful after the Email is sent.
The Conversation ID is null for a new Email.
Any other property, by which I can exactly read an Email that I have sent.
回答1:
You can set a named property on the item before sending it using MailItem.UserProperties or ailItem.PorpertyAccesor, then search for that property in the Sent Items folder (MAPIFolder.Items.Find).
UPDATE. The query for MAPIFolder.Items.Add
would be
set item = MAPIFolder.Items.Find("@SQL=""http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/Spartan"" = 'test123' ")
回答2:
The Entry ID wont help coz, its not a Unique Id that exists for the mail... it changes whn moved from one folder to another...In your case what would help is to access the Sent items folder and access the item by Index n verify tht its the same that you sent by checking some other attributes of the mail like the Subject, Sender etc.
回答3:
This is what I did. As soon as the Email is sent, in the next line of code, I read the last sent mail and stored the Entry ID in a static class variable. We can Find the item through Entry ID in the Sent Items folder.
来源:https://stackoverflow.com/questions/27895390/how-can-get-the-exact-sent-email-from-sent-items-folder