从 EmailMessage 获取位置作为交换

Getting location from EmailMessage in exchange

我可以阅读 EmailMessage。现在我需要使用 C# 获取位置 属性。

我可以访问 SubjectFromTo 等属性,但没有找到任何 属性,例如 Location

基本上我正在为 Exchange 开发自定义传输代理。在 OnEndOfData 处理程序中,我需要位置。

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

更新

EmailMessageMicrosoft.Exchange.Data.Transport.Email.EmailMessage 的一种,而不是 Microsoft.Exchange.WebServices.Data.EmailMessage

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

Microsoft.Exchange.WebServices.Data.EmailMessage 是 EWS Class 并且您不在传输代理中使用 EWS。

你不会从 EmailMessage class 中得到 属性 我建议

如果你有 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

您应该也可以使用 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