none
E2007, 1.1, VB.net: Getting the Message-ID of a sent message RRS feed

  • Question

  • Hello, 

    I want to get the Message-ID as it appears in the header, for example:

    Message-ID: <CAJ1aTdn3XU5Ef65ne2QjR+4tp4j9NwC_0GVJ0yna3sJ_oC9tsQ@mail.gmail.com>

    I thought that I could accomplish this by adding an IDFinderProperty to the extended properties when I send the email, and then doing the following:

    Dim view As New ItemView(1)
            Dim searchFilter As New SearchFilter.IsEqualTo(IDFinderProperty, idFinder.ToString)
            view.PropertySet = New PropertySet(BasePropertySet.IdOnly, IDFinderPropderty)
            Dim results As FindItemsResults(Of Item) = ExService.FindItems(WellKnownFolderName.SentItems, searchFilter, view)

    Dim valueIWant as String = results(0).Id.UniqueId

    ValueIWant is equal to a long string, for example: AAMkAGZhMzg2YzY4LWZlNmUtNGY1NC1hYjA1LWI2MGU1ZTBjNWExMABGAAAAAAArvEFCwQpXR6V9didpqSH3BwDB3586g3ylTJHN3+148snhAAqsALBbAADB3586g3ylTJHN3+148snhABno/iywAAA=

    When I check the internet header on the received message though, the Message-ID property is a GUID, and the 'ValueIWant' is not contained anywhere in the message. 

    How can I figure out what Message-ID value is being sent out when I send things through EWS?

    Thanks!

    Friday, February 24, 2012 9:28 PM

All replies

  • I found I was able to add a Message-ID header in this manner:

          Dim prop As ExtendedPropertyDefinition = New ExtendedPropertyDefinition(DefaultExtendedPropertySet.InternetHeaders, "Message-                ID", MapiPropertyType.String)
           message.SetExtendedProperty(prop, "<" & idFinder.ToString & "@mymailserver.com>")

    And it then showed up as expected, both internally, and also when sending to external emails. 

    Does anybody see any problems with this approach?

    Friday, February 24, 2012 10:07 PM