Mar*_*rco 5 c# exchangewebservices appointment office365
我正在使用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;
}
Run Code Online (Sandbox Code Playgroud)
Gle*_*les 14
您的代码没有任何问题,但这与邮箱的配置方式有关.使用Rooom邮箱,您可以使用Remote Power-shell和set-calendarprocessing cmdlet配置自动处理设置,请参阅http://technet.microsoft.com/en-us/library/dd335046(v=exchg.150).aspx eg
对于您的特定问题,已使用DeleteSubject参数配置邮箱,该参数"指定是否删除或保留传入会议请求的主题.此参数的有效输入为$ true或$ false.默认值为$ true." 和AddOrganizerToSubject参数,"指定会议组织者的名称是否用作会议请求的主题.此参数的有效输入为$ true或$ false.默认值为$ true."
您将无法修复现有数据,但如果您重新配置邮箱,则任何新发送的约会都将以您希望的方式显示
干杯格伦
| 归档时间: |
|
| 查看次数: |
1654 次 |
| 最近记录: |