目标是某人的Exchange日历(2007)。我想在某人的日历中添加一个简单的“约会事件”。此代码有效(我使用的是Microsoft.Exchange.WebServices.dll):
service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
service.Credentials = new NetworkCredential("supervisor", "password", "DOMAIN.COM");
service.AutodiscoverUrl("<employee@domain.com>", ValidateRedirectionUrlCallback);
appt = new Appointment(service);
appt.Subject = "<subject>";
appt.Body = "<Body Text>";
appt.Start = _DateFrom;
appt.End = _DateTo;
appt.Sensitivity = Sensitivity.Private;
appt.Save(WellKnownFolderName.Calendar);
但是,此代码存在问题:
答案 0 :(得分:1)
而不是WellKnownFolderName.Calendar
您应该使用新的FolderId(WellKnownFolderName.Calendar,“employee@domain.com”)
所以最后一行变成了 appt.Save(new FolderId(WellKnownFolderName.Calendar,“employee@domain.com”));
同样遇到换行问题,这只是从版本1.1开始,所以它可能是一个错误