1

I can read an EmailMessage. Now I need to get the location property using C#.

enter image description here

I can access the properties like Subject, From, To and etc but did not find any property like Location

Basically I am developing a custom transport agent for Exchange. In the OnEndOfData handler, I need Location.

private void MazeMapAgent_OnEndOfData(ReceiveMessageEventSource source, EndOfDataEventArgs e)
        {
            EmailMessage emailMessage = e.MailItem.Message;
        }

Update

EmailMessage is a type of Microsoft.Exchange.Data.Transport.Email.EmailMessage not Microsoft.Exchange.WebServices.Data.EmailMessage

Atish Kumar Dipongkor
  • 10,220
  • 9
  • 49
  • 77

1 Answers1

1

EmailMessage is a type of Microsoft.Exchange.Data.Transport.Email.EmailMessage not Microsoft.Exchange.WebServices.Data.EmailMessage

Microsoft.Exchange.WebServices.Data.EmailMessage is an EWS Class and you don't use EWS in a Transport Agent.

You wont get that property out of the EmailMessage class i would suggest

If you have a TNEFStream https://msdn.microsoft.com/en-us/library/office/aa579434(v=exchg.140).aspx then you need to parse the TNEF properties on the message using the TNEFReader and you should then be able to get that Mapi property https://msdn.microsoft.com/en-us/library/office/cc842419.aspx

You should also be able to use the iCal Reader https://msdn.microsoft.com/en-us/library/office/aa579407(v=exchg.140).aspx theres a sample for that http://blogs.technet.com/themes/blogs/generic/post.aspx?WeblogApp=jasoning&y=2011&m=08&d=17&WeblogPostName=icalendar-property-rewrite

Glen Scales
  • 20,495
  • 1
  • 20
  • 23