【问题标题】:How can I export all the Appointments in .ics file using EWS?如何使用 EWS 导出 .ics 文件中的所有约会?
【发布时间】:2015-10-31 11:18:09
【问题描述】:

我正在使用 EWS 来管理 Exchange Server 电子邮件帐户的操作。如何导出 .ics 文件中的所有日历约会? 我已经尝试过。

string iCalFileName = Path.Combine(Path.GetTempPath(), "appointments.ics");
foreach (Appointment appointment in service.FindItems(WellKnownFolderName.Calendar, new ItemView(int.MaxValue)))
{
    appointment.Load();
    using (FileStream fs = new FileStream(iCalFileName, FileMode.Create, FileAccess.Write))
    {
        using (StreamWriter s = new StreamWriter(fs))
        {
            s.WriteLine(appointment.MimeContent.Content);//error must load property before using it
        }
    }
}

谁能建议我在这里缺少什么?

【问题讨论】:

    标签: c# winforms exchangewebservices exchange-server-2007


    【解决方案1】:

    当您使用 FindItem 时,不会返回 MimeContent(和许多其他属性),您需要对每个项目进行单独的 GetItem 调用以检索它。最好的办法是使用 LoadPropertiesFromItems,它将在托管 API 中批量处理 GetItem 请求,请参阅http://blogs.msdn.com/b/exchangedev/archive/2010/03/16/loading-properties-for-multiple-items-with-one-call-to-exchange-web-services.aspx

    干杯 格伦

    【讨论】:

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