我使用EWS检索我办公室365帐户中特定房间的所有约会。在返回约会时,约会的主题属性包含组织者的名称,而不是我给予约会的主题。
我做错了什么?
我是如何做的代码示例:
ExchangeService service = new ExchangeService();
service.Credentials = new WebCredentials("username", "password");
service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
DateTime StartDate = DateTime.Today.AddDays(-30);
DateTime EndDate = DateTime.Today.AddDays(60);
CalendarView cv = new CalendarView(StartDate, EndDate);
FolderId CalendarFolderId = new FolderId(WellKnownFolderName.Calendar, "room1@company.com");
CalendarFolder calendar = CalendarFolder.Bind(service, CalendarFolderId);
FindItemsResults<Appointment> appointments = calendar.FindAppointments(cv);
foreach (Appointment appointment in appointments.ToList())
{
//this contains the wrong value.....
string subject = appointment.Subject;
//this is correct and has the same value as the incorrect subject
string organizer = appointment.Organizer.Name;
}
答案 0 :(得分:14)
您的代码没有任何问题,但这与邮箱的配置方式有关。使用Rooom邮箱,您可以使用Remote Power-shell和set-calendarprocessing cmdlet配置自动处理设置,请参阅http://technet.microsoft.com/en-us/library/dd335046(v=exchg.150).aspx,例如
对于您的特定问题,已使用DeleteSubject参数配置邮箱,该参数“指定是否删除或保留传入会议请求的主题。此参数的有效输入为$ true或$ false。默认值为$ true。 “和AddOrganizerToSubject参数,“指定会议组织者的名称是否用作会议请求的主题。此参数的有效输入为$ true或$ false。默认值为$ true。”
您将无法修复现有数据,但如果您重新配置邮箱,则会发送任何新约会
干杯 格伦