问题
I am developing a custom transport agent for Exchange 2013. I am getting null
in e.MailItem.Message.CalendarPart
though I am sending a meeting request.
if (e.MailItem.Message.CalendarPart != null)
{
LocationProcessorStrategy.AddLocationInBody(e.MailItem.Message);
}
else
{
e.MailItem.Message.Subject += " [There is no calendar part - added by agent.]";
}
e.MailItem.Message.MapiMessageClass
is giving me the value "IPM.Schedule.Meeting.Request"
but CalendarPart
is null.
回答1:
That generally means that at the Messaging stage you trying to intercept the message there is no ICal Body part to parse. iCal is usually create post categorisation depending on the recipient type https://technet.microsoft.com/en-us/library/bb232174(v=exchg.150).aspx . So either push your Agent to run after categorisation has occurred or use the TNEFReader/TNEFWriter to parse the TNEFStream for the message. Note you may need two solution if you want process bother internal and external Calendar Invites because of the formats used.
来源:https://stackoverflow.com/questions/38367946/getting-null-in-e-mailitem-message-calendarpart-in-exchange-transport-agent