none
Getting the free/busy state of the meeting room in a range of time using EWS API RRS feed

  • Question

  • I have a problem with getting the free/busy status of the meeting in a given range of time using EWS API

    According to The MSDN Document,we can get  the free/busy status by GetUserAvailability() api. However we can't get the free status in a range of time,it can only show the busy calendar event.Moreover the calendar class can only show the method of

    FreeBusyStatus,StartTime,EndTime,when i try to get the Details,it always shows that "Object reference not set to an instance of an object".

    does anyone have a solution for me on how to get the free status of a meeting?what the api?

    thanks a lot.please


    • Edited by little q Monday, June 16, 2014 5:14 AM
    Monday, June 16, 2014 4:53 AM

All replies

  • What does the code your using look like, EWS will only return the information you request of it so if you not requesting the correct FreeBusy level (eg DetailedMerged) then you will only get certain information returned. But you need to post you code so somebody can comment on it either way.

    The other thing to check is make sure the Mailbox your trying to report on is publishing freebusy information eg use Outlook or OWA to look at the freebusy status using the schedule assistant.

    Cheers
    Glen

    Monday, June 16, 2014 6:35 AM
  • sorry,i didn't say clearly.let me give an example:

    if i give a time arrange of 12:00to1:00.how can i  judge this period of time is free or busy.using what api?

    Monday, June 16, 2014 7:06 AM
  • I want toi show as:

    12:00~13:00  free

    Monday, June 16, 2014 7:17 AM
  • I'm not sure I understand your question if the FreeBusy time is busy for a parituclar mailbox this is because there is a specific appointment scheduled at that time. So you need to change the FrreBusy status of the appointment that is sceduled at that particular time.

    If you just want to show the freeBusy status of a Mailbox use the MergedFreeBusyStatus Information that is returned eg

                DateTime StartTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 0:00"));
                DateTime EndTime = StartTime.AddDays(1);
                TimeWindow tmTimeWindow = new TimeWindow(StartTime, EndTime);
                AvailabilityOptions aoOptions = new AvailabilityOptions();
                aoOptions.RequestedFreeBusyView = Microsoft.Exchange.WebServices.Data.FreeBusyViewType.DetailedMerged;
                aoOptions.MeetingDuration = 30;
                List<AttendeeInfo> atAttendeeList = new List<AttendeeInfo>();
                atAttendeeList.Add(new AttendeeInfo("user@domain.com"));
                GetUserAvailabilityResults avResponse = service.GetUserAvailability(atAttendeeList, tmTimeWindow, AvailabilityData.FreeBusy, aoOptions);
                Int32 atnCnt = 0;
                foreach (AttendeeAvailability avail in avResponse.AttendeesAvailability)
                {
                    Console.WriteLine(atAttendeeList[atnCnt].SmtpAddress);
                    Int32 mc =0;
                    var merged = avail.MergedFreeBusyStatus;
                    while (StartTime < EndTime) {
                        Console.WriteLine(StartTime.ToString() + " " +  merged[mc]);
                        mc++;
                        StartTime = StartTime.AddMinutes(30);
                    }            
                    foreach (Microsoft.Exchange.WebServices.Data.CalendarEvent calendarItem in avail.CalendarEvents)
                    {
                        Console.WriteLine("Free/busy status: " + calendarItem.FreeBusyStatus);
                        Console.WriteLine("Start time: " + calendarItem.StartTime);
                        Console.WriteLine("End time: " + calendarItem.EndTime);
                        Console.WriteLine();
                    }
                    atnCnt++;
                }
    Cheers
    Glen

    Tuesday, June 17, 2014 4:22 AM