Ews,Body消息编码错误

时间:2017-05-10 10:24:13

标签: c# asp.net-mvc exchangewebservices

在我的MVC项目中,我使用ews在Outlook日历中创建和更新约会我遇到了一个小问题。当我使用ews在Outlook日历中创建/更新约会时,正文消息显示不正确!

我正在添加

appt.Body = "rådgivning Møde"

在Outlook日历中,此消息将显示为:r?dgivning M?de

Appointment appt = Appointment.Bind(ExchangeServerConnection, apptID, new 
PropertySet(AppointmentSchema.Subject, AppointmentSchema.Body, AppointmentSchema.TextBody, AppointmentSchema.LegacyFreeBusyStatus));    

if (appt.LegacyFreeBusyStatus == appstatus)
{
    appt.Subject = subject;
    appt.Body = message;
    appt.LegacyFreeBusyStatus = LegacyFreeBusyStatus.Busy;

    //set explicit mode to SendToNone. Default mode is SendToAllAndSavecopy, it converts appointment to meeting.
    SendInvitationsOrCancellationsMode mode = SendInvitationsOrCancellationsMode.SendToNone;

    appt.Update(ConflictResolutionMode.AlwaysOverwrite, mode);

1 个答案:

答案 0 :(得分:0)

您需要指定内容编码(请参阅此question here)。因此,如果您使用HTML,您的身体必须标记为UTF-8或符合您需求的内容:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

更多信息请参阅Microsoft howto here