Search code examples
vstooutlook-addinoutlook-2007

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


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.


Solution

  • 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' ")