2

我正在尝试在共享日历上获取当天所有约会的列表。我已经成功地为我自己的与我的用户帐户绑定的日历完成了它。我尝试获取共享日历的 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);

我不知道这是否可以访问共享文件夹,并且我无法弄清楚共享文件夹的文件夹ID。

4

1 回答 1

-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/

于 2013-05-30T09:05:15.337 回答