C# EWS - identification for SENT emails - InternetMessageId

前端 未结 1 1709
刺人心
刺人心 2021-01-24 08:16

Im developing a Tickets System. I need to send a Ticket(mail) to a EmailAddressList and receive the answers by email regarding to this Email/Ticket. Is there anyway to get an I

1条回答
  •  面向向阳花
    2021-01-24 08:46

    Make sure that when you send your messages that you use SendAndSaveCopy() to place a copy of the message in the SentItems folder. Then you will want to use the FindItems() method to look for messages in the WellKnownFolderName.SentItems, instantiate an EmailMessage object and then you can look at the InternetMessageId property. Here is a brief example:

    ItemView view = new ItemView(10);
    view.PropertySet = new PropertySet(BasePropertySet.IdOnly, EmailMessageSchema.InternetMessageId);
    FindItemsResults results = service.FindItems(WellKnownFolderName.SentItems, view);
    foreach (Item item in results)
    {
        if (item is EmailMessage)
        {
            EmailMessage msg = item as EmailMessage;
            Console.WriteLine(msg.InternetMessageId);
        }
    }
    

    Here are a couple of links that may help you further:

    How to: Send email messages by using EWS in Exchange

    EmailMessage members

    0 讨论(0)
提交回复
热议问题