我正在尝试使用Exchange Web服务托管API从特定会议室检索约会列表。 我正在使用Office365和Exchange Online。 我尝试了以下代码。
try
{
ExchangeService newExchangeService = new ExchangeService (ExchangeVersion.Exchange2013);
//Admin permission account
newExchangeService.Credentials = new NetworkCredential(username, password);
newExchangeService.AutodiscoverUrl(email-id, RedirectionUrlValidationCallback);
SearchFilter.SearchFilterCollection searchFilter = new SearchFilter.SearchFilterCollection();
searchFilter.Add(new SearchFilter.IsGreaterThanOrEqualTo(AppointmentSchema.Start, startDate));
searchFilter.Add(new SearchFilter.IsLessThanOrEqualTo(AppointmentSchema.Start, endDate));
ItemView view = new ItemView(50);
view.PropertySet = new PropertySet(BasePropertySet.IdOnly, AppointmentSchema.Subject, AppointmentSchema.Start, AppointmentSchema.AppointmentType, AppointmentSchema.End);
var calendarSearch = new FolderId(WellKnownFolderName.Calendar, new Mailbox("adachi@fairuse.jp"));
var appointmentresult = service.FindItems(calendarSearch, searchFilter, view);
}catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}
我收到了错误:
在商店中找不到指定的文件夹。
显然这是一个权限问题,但此权限设置在何处?
答案 0 :(得分:0)
您不必创建新邮箱,只有邮件地址的字符串就足够了:
var calendarSearch = new FolderId(WellKnownFolderName.Calendar, "adachi@fairuse.jp");
至于权限:你是否在域中?你使用NTLM还是ADFS?