【问题标题】:Ews, Body message in wrong encodingEws,错误编码的正文消息
【发布时间】:2017-05-10 10:24:12
【问题描述】:

在我的 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);

【问题讨论】:

  • 我建议您在代码中启用跟踪msdn.microsoft.com/en-us/library/office/…,然后发布正在发送到服务器的 XML。它应该都是 UTF8,所以它不应该是一个问题,但这会告诉你什么是发布到服务器。

标签: c# asp.net-mvc exchangewebservices


【解决方案1】:

您需要指定内容编码(也请参见question here)。因此,如果您使用 HTML,则必须通过以下方式将您的正文标记为 UTF-8 或符合您需求的内容:

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

更多信息见Microsoft howto here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多