我正在尝试在共享日历上获取当天所有约会的列表。我已成功完成了与我的用户帐户绑定的自己的日历。我尝试获取共享日历的folderId,但我找不到它。
我使用它来使用其folderId来访问我的日历,它起作用了:
Console.WriteLine("Listing appointments...");
//open the calendar
CalendarFolder calendar = CalendarFolder.Bind(service, WellKnownFolderName.Calendar);
//query for appointments in next 10 days
//FindItemsResults<Appointment> appointments = calendar.FindAppointments(new CalendarView(DateTime.Now, DateTime.Now.AddDays(10)));
//find appointments and write out subject
foreach (Appointment appointment in service.FindItems(new FolderId("FOLDERIDHERE"), new ItemView(int.MaxValue)))
Console.WriteLine(appointment.Subject);
我不知道这是否可以访问共享文件夹,我无法弄清楚共享文件夹的folderID。
答案 0 :(得分:-2)
您可以尝试这样的事情:
CalendarModule calModule = (CalendarModule)this.Application.ActiveExplorer().NavigationPane.Modules.GetNavigationModule(OlNavigationModuleType.olModuleCalendar);
foreach (NavigationGroup group in calModule.NavigationGroups)
{
NavigationFolders folders = group.NavigationFolders;
MAPIFolder OtherFolder = null;
Items OtherFolderItems = null;
for (int i = 1; i <= group.NavigationFolders.Count; i++)
{
OtherFolder = folders[i].Folder; //This does not work for me
OtherFolderItems = OtherFolder.Items;
}
不幸的是,这段代码对我来说不起作用,因为试图访问.Folder启动异常。我在此链接上找到了这个:http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/4891d3a5-f578-495c-83aa-f5a914474c78/