none
EWS: Confirming Room response (Accepted/Declined) when creating appointment where room is invited RRS feed

  • Question

  • Hello,

    I have a problem when I book a room using the EWS API. I would like to create an appointment and book (invite) a room. Is there a good way to confirm that the room said yes?

    Today we do pretty much this:

    • Create appointment
    • Wait for room to respond (sleep)
    • Check if room accepted booking

    Today we have a sleep call in our code because the room status is Unknown for quite some time...

    Why does it take around 4s to get the room response? (I have heard it's because the room is really a mailbox?)

    There must be a better way, right?

    I would be super thankful for any ideas how to do this better, Thanks!

    // Henrik

    ExchangeService service = exchange.create_service(data.username, data.usermail, data.password);
    
    meeting = new Appointment(service);
    
    DateTime time_start = DateTime.ParseExact(data.time_start,
                            "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture);
                    DateTime time_end = DateTime.ParseExact(data.time_end,
                            "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture);
    
    meeting.Subject = data.subject;
    meeting.Start = time_start;
    meeting.End = time_end;
    meeting.Location = data.location;
    meeting.Resources.Add(data.roommail);
    meeting.Save(SendInvitationsMode.SendOnlyToAll);
    
    // Allow room to respond
     Thread.Sleep(4000);
    
    Appointment appointment = Appointment.Bind(service, meeting.Id);
    
    PropertySet propset = new PropertySet(BasePropertySet.IdOnly,
                                                           AppointmentSchema.Resources,
                                                            AppointmentSchema.Start,
                                                            AppointmentSchema.End,
                                                            AppointmentSchema.Organizer);
    
    appointment.Load(propset);
    
    // Verify room status
    verify_resource(appointment.Resources, data);
    


    Thursday, May 26, 2016 4:40 PM

Answers

  • >> Why does it take around 4s to get the room response? (I have heard it's because the room is really a mailbox?)

    What happens when on the server is that your code generates a invitation messages that is sent to the Meeting room mailbox, depending where that meeting room mailbox is located eg in a multiple server environment it maybe located on another server which maybe in another site or datacentre etc. The invitation then needs to routed to the Meeting room mailbox, once it arrives it will be evaluated an Exchange server process and the meeting will then be Accepted or declined and a response will then be generated and sent back to the Sender.

    If you want to confirm a Meeting room accepted the invitation you have to either wait for the response of wait until you see the Meeting added to the Calendar of the Meeting room. This process won't be instantaneous that's just the way it is you should check the availability of the Meeting room first using freebusy or just accessing the calendar if its free there shouldn't be a reason to reject the Meeting.

    Cheers
    Glen

    • Marked as answer by Henrik3456 Friday, May 27, 2016 8:32 AM
    Friday, May 27, 2016 1:56 AM

All replies

  • You can check free/busy information 

    https://technet.microsoft.com/en-us/library/bb123495(v=exchg.141).aspx


    sachin hodge

    Thursday, May 26, 2016 5:32 PM
  • >> Why does it take around 4s to get the room response? (I have heard it's because the room is really a mailbox?)

    What happens when on the server is that your code generates a invitation messages that is sent to the Meeting room mailbox, depending where that meeting room mailbox is located eg in a multiple server environment it maybe located on another server which maybe in another site or datacentre etc. The invitation then needs to routed to the Meeting room mailbox, once it arrives it will be evaluated an Exchange server process and the meeting will then be Accepted or declined and a response will then be generated and sent back to the Sender.

    If you want to confirm a Meeting room accepted the invitation you have to either wait for the response of wait until you see the Meeting added to the Calendar of the Meeting room. This process won't be instantaneous that's just the way it is you should check the availability of the Meeting room first using freebusy or just accessing the calendar if its free there shouldn't be a reason to reject the Meeting.

    Cheers
    Glen

    • Marked as answer by Henrik3456 Friday, May 27, 2016 8:32 AM
    Friday, May 27, 2016 1:56 AM
  • Thanks Glen,

    Now I have a better understanding. As you mentioned I guess we have two options:

    - If we want to be absolutely sure the booking goes through we have to keep checking the room status after our booking to make sure we actually got the room responding with status "Accepted".

    - If we want our app to be it fast we check the room free/busy information first and then assume our booking goes through. (with a small chance/risk that someone else is able to book the room before us).

    Thanks again.

    // Henrik

    Friday, May 27, 2016 8:39 AM