none
How to get mailitems restricted by recipients RRS feed

  • Question

  • Hi,

    i'm developing a windows form application with outlook interop.

    i've got a simple mail address, and i need to get mail messages from a folder, where my mail is sender and then where the same mail is inside recipients.

    For the first purpose the solution is simple: i use restrict method

    Application myApp = new Application();
    NameSpace mapiNameSpace = myApp.GetNamespace("MAPI");
    MAPIFolder myInbox = mapiNameSpace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);

    string filter = "@SQL=\"http://schemas.microsoft.com/mapi/proptag/0x0065001F\" = '{0}'";
    Items mailMessages = myInbox .Items.Restrict(string.Format(filter, emailAddress));

    for the second one (get messages by recipients) i have no idea: the problem is that mailmessage item hasn't got a field with recipients mail, it has only recipients name. it seems that the only solution is to iterate through every mail, get recipients and compare recipient mail with mine. this solution is very very slow. Is there a way to use something like restrict method with recipients field?

    thanks

    • Moved by Lisa Zhu Thursday, November 1, 2012 2:02 AM outlook dev related (From:Visual C# General)
    Tuesday, October 30, 2012 4:51 PM

All replies

  • Hi ratal,

    From your description , I ‘d like to move this post to  the most related forum .

    There are more  experts in this aspect  , so you will get  better support and  may have more luck getting answers .

    Thanks for your understanding .

    Regards ,


    Lisa Zhu [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, November 1, 2012 2:02 AM