Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何使用EWS导出.ics文件中的所有约会?_C#_Winforms_Exchangewebservices_Exchange Server 2007 - Fatal编程技术网

C# 如何使用EWS导出.ics文件中的所有约会?

C# 如何使用EWS导出.ics文件中的所有约会?,c#,winforms,exchangewebservices,exchange-server-2007,C#,Winforms,Exchangewebservices,Exchange Server 2007,我正在使用EWS管理Exchange Server电子邮件帐户的操作。如何在.ics文件中导出日历的所有约会? 我已经试过了 string iCalFileName = Path.Combine(Path.GetTempPath(), "appointments.ics"); foreach (Appointment appointment in service.FindItems(WellKnownFolderName.Calendar, new ItemView(int.MaxValue))

我正在使用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
        }
    }
}
有人能告诉我这里缺少什么吗?

当您使用FindItem时,不会返回mimContent(以及许多其他属性),您需要对每个项进行单独的GetItem调用才能检索它。最好的做法是使用LoadPropertiesFromItems,它将在托管API中批处理GetItem请求,请参阅

干杯
Glen

我想导出ics文件中的所有约会,就像gmail一样。我已经试过了,但没有成功。我已经试过了。我也试过你的解决办法。你能给我推荐一个链接或示例,帮助我导出ics文件中的所有约会/会议吗?我建议你先发布日历,然后你就可以像gmail一样获取Ical提要。