none
Find mail item by EntryID RRS feed

  • Question

  • Hello.

    I need to monitor all incoming e-mails.

    I am using the

    void Application_NewMailEx(string EntryIDCollection)

    event to get the incoming e-mails. So i know the entryid. I write it into a textfile and later i try to get information from these mails.

    The problem is that in a method the following line

    Object mail = mails.Find("EntryID='000000002540AF5F2084FC4EAAA722FE626B4F3BC4082000'");


    throws error "Condition is not valid"

    Where am i wrong?
    Wednesday, November 19, 2008 4:33 PM

Answers

  •  Hi,

    The method you used is not the correct way ,mails.Find method needs a parameter which is a DASL expression,please check the following links:
    http://msdn.microsoft.com/en-us/library/cc513841.aspx
    http://msdn.microsoft.com/en-us/library/bb220350.aspx

    the right way is use NameSpace.GetItemFromID method like this:

      Outlook.NameSpace ns = outlookObj.GetNamespace("MAPI");  
      fldcalender = (Outlook.Folder)ns.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar);  
    Outlook.MailItem Item;  
    Item = ns.GetItemFromID("00000000595626E799FB2F47AE683EE19220B7620700478082F1DA5A2142985C03C6E2C128E20019272612280000978CF7A6A4BB9F4A8B513A44A5E65CF50019228B043F0000", fldcalender.StoreID) as Outlook.MailItem ; 

    Thanks
    • Edited by Tim Li Friday, November 21, 2008 6:18 AM extend
    • Marked as answer by Tim Li Thursday, November 27, 2008 1:47 AM
    Friday, November 21, 2008 6:14 AM

All replies

  •  Hi,

    The method you used is not the correct way ,mails.Find method needs a parameter which is a DASL expression,please check the following links:
    http://msdn.microsoft.com/en-us/library/cc513841.aspx
    http://msdn.microsoft.com/en-us/library/bb220350.aspx

    the right way is use NameSpace.GetItemFromID method like this:

      Outlook.NameSpace ns = outlookObj.GetNamespace("MAPI");  
      fldcalender = (Outlook.Folder)ns.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderCalendar);  
    Outlook.MailItem Item;  
    Item = ns.GetItemFromID("00000000595626E799FB2F47AE683EE19220B7620700478082F1DA5A2142985C03C6E2C128E20019272612280000978CF7A6A4BB9F4A8B513A44A5E65CF50019228B043F0000", fldcalender.StoreID) as Outlook.MailItem ; 

    Thanks
    • Edited by Tim Li Friday, November 21, 2008 6:18 AM extend
    • Marked as answer by Tim Li Thursday, November 27, 2008 1:47 AM
    Friday, November 21, 2008 6:14 AM
  • Hello,

    I have query on entry id of the mail.

    May i know what you are using for for getting the entry id of the incoming mail in outlook.

    I'm using the EWS service for getting the new mail recognition.

    I found unique Id which is different from what i'm searching for.

    I want email entry id for the new mail in C# other than VB.net. Please help me

    Thanks in advance


    Monday, April 16, 2018 6:30 AM