locked
EWS Java API - GetRooms returning empty set. RRS feed

  • Question

  • Hi,

    We have EWS servers (2007 SP1 and 2010) which is manage by the Java EWS API. We are trying to execute the following code:

    ExchangeService service = new ExchangeService( ExchangeVersion.Exchange2010_SP1 );
    
    service.setUrl( new URI(String.format(EWS_SERVICE_ENDPOINT, serviceHostName)) );
    
    service.setCredentials( new WebCredentials(username, password, domain) );
    
    EmailAddressCollection rooms = service.getRoomLists();
    System.out.println( rooms.getCount() );

    But it always return empty list even if there are rooms when we login through the OWA panel and try to create and appointment with resources.

    Are we missing any setting/configuration in the server? What could be possible reason and a valid solution to solve this issue?

    Thursday, July 19, 2012 12:54 PM

All replies

  • This seems more like a Server configuration issue since when I enable debug mode in Java API, I can see the ews service returning a response with the GetRoomsList empty. See the XML below:

    Input XML to the server:

    <?xml version='1.0' encoding='utf-8'?>
    <soap:Envelope 
            xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
            xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
    
      <soap:Header>
        <t:RequestServerVersion version="Exchange2010_SP1"/>
      </soap:Header>
    
      <soap:Body>
        <m:GetRoomLists/>
      </soap:Body>
    </soap:Envelope>

    Response from the server:

    <?xml version="1.0" encoding="utf-8"?>
    <s:Envelope
            xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
      <s:Header>
        <h:ServerVersionInfo MajorVersion="14" MinorVersion="1" MajorBuildNumber="355" MinorBuildNumber="2" Version="Exchange2010_SP1" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
      </s:Header>
    
      <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <GetRoomListsResponse ResponseClass="Success" xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
          <ResponseCode>NoError</ResponseCode>
          <m:RoomLists xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"/>
        </GetRoomListsResponse>
      </s:Body>
    </s:Envelope>

    But when I login through the browser and create an appointment, I can select resources/rooms from a list. I believe this is not an issue with the Java EWS API library, but an issue on the EWS server.

    Thursday, July 19, 2012 3:39 PM
  • There are no RoomLists created by default in Exchange 2010 so you need to first use New-DistributionList http://technet.microsoft.com/en-us/library/aa998856.aspx with the -RoomList switch to create one. There is a difference between using RoomLists and just using the room finder this explains it http://blogs.technet.com/b/educloud/archive/2011/11/07/get-a-room-enable-room-finder-with-room-list-distribution-groups.aspx

    Cheers
    Glen

     
    Monday, July 23, 2012 6:58 AM
  • Glen,

    Thanks for the reply, We will try this out.

    I had another concern:

    Is there an alternative (API or Code) that you know to get the list of rooms/resources in EWS 2007.

    Monday, July 23, 2012 7:21 AM
  • Room lists are a Exchange 2010\Outlook2010 feature

    You can do more or less the same thing just using ExpandGroup http://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.exchangeservice.expandgroup(v=exchg.80).aspx which will return the individual members email addresses of a particular DistributionList.

    Cheers
    Glen

    Monday, July 23, 2012 7:29 AM
  • Thanks Glen for your wonderful support!
    Monday, July 23, 2012 7:35 AM
  • Hello Glen!

    I have tried to achieve this for a long time. Is there a generic distributionList that contains all the rooms in Exchange?

    Example:

    ExpandGroupResults egr = service.ExpandGroup("distributionList?");

    Wednesday, August 8, 2012 1:30 PM