如何在.net中获取非共享约会参加者的空闲/忙碌信息?

时间:2015-12-10 12:56:49

标签: .net outlook

如何在.net中获取非共享约会与会者的空闲/忙碌信息?

我们只能获得共享日历约会吗?

Recipient oRecip = ons.CreateRecipient("xxxxxx");
            MAPIFolder usersCalendarFolder = ons.**GetSharedDefaultFolder**(oRecip, OlDefaultFolders.olFolderCalendar);

enter image description here

2 个答案:

答案 0 :(得分:1)

使用Recipient.FreeBusy。或AddressEntry.GetFreeBusy

答案 1 :(得分:0)

        ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP1);
        service.UseDefaultCredentials = true;
        service.Url = new Uri("https://xxxxxxxxx/EWS/Exchange.asmx");

        List<AttendeeInfo> attendees = new List<AttendeeInfo>();
        attendees.Add(new AttendeeInfo("xxxxxx"));

        GetUserAvailabilityResults results =
            service.GetUserAvailability(attendees,
                new TimeWindow(DateTime.Now.Date, DateTime.Now.Date.AddHours(24)),
                AvailabilityData.FreeBusy);

        AttendeeAvailability myAvailablity = results.AttendeesAvailability.FirstOrDefault();

        if (myAvailablity != null)
        {
            Console.WriteLine(String.Format(
                "You have {0} appointments/meetings in the next 24 hours",
                myAvailablity.CalendarEvents.Count));
        }