How, can get the exact sent Email from Sent Items folder?

折月煮酒 提交于 2019-12-11 13:38:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!