EWS Java API 1.1.5: Chicken or egg problem: autodiscoverUrl() and resolveName() RRS feed

  • Question

  • Hi,

    I've got the following problem: I would like to use autodiscoverUrl() for my exchangeService object. The methods expect the authorization user's mailaddress. However, all I've got is the authorization user's name (used for credentials).

    It is possible to get the authorizations user's mail address by his name, using the exchangeService.resolveNames() method. But here is the problem: I don't have the fully configured exchangeService object at that point to resolve the authorization user's name.

    So how/could autodiscoverUrl() work with an authorization's name only?

    I would be very grateful for recommendations.

    Best wishes


    Wednesday, February 22, 2012 10:11 AM

All replies

  • You would need to look up Active Directory via LDAP or WMI and grab the SMTP address of the user from the Mail Property before you can then start using Autodiscover to work out the CAS end point. The EmailAddress is a mandatory property as far as EWS is concerned.


    Thursday, February 23, 2012 4:09 AM
  • Hi Glen,

    thanks for your response. At the moment I've got no idea on if we are programmatically able to get the smtp address via LDAP or WMI. For now, I developed the following solution:

    If autodiscovering service is enabled in our application, the exchangeService-object is nevertheless build with its normal url, overhanded to another method which resolves with that object the smtp address, instantiates a new exchangeService-object and copies all properties of the overhanded one (except for the url property) together with the found smtp address, try's to autodiscover the url and returns the in that way initialized exchangeService-object.

    Do you think this is a rather inefficient way or might be ok?

    Best wishes


    Thursday, February 23, 2012 10:12 AM
  • It sounds a little convoluted but without seeing the code your using I can't really comment. All you really need is the Email domain for the accounts your going to be working with if Autodiscover is setup you then should be able to discover the URL for the CAS server to use. Different environments, load balancing solutions etc provide different challenges if what your doing works then its probably okay.


    Friday, February 24, 2012 7:12 AM