Exchange Web Services和c#:如何从共享日历中获取约会

本文关键字:共享 日历 约会 获取 Services Web Exchange | 更新日期: 2023-09-27 18:12:54

我试图在共享日历上获得当天所有约会的列表。我已经成功地为我自己的日历绑定了我的用户帐户。我试着获取共享日历的文件夹id,但是我没能找到它。

我用它来访问我的日历使用它的文件夹id,它工作:

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

Exchange Web Services和c#:如何从共享日历中获取约会

你可以尝试这样做:

        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/