none
How to AutodiscoverUrl? RRS feed

  • Question

  • Is it possible to get the version of MS Exchange using the EWS API?

    I am trying to discover the ExchangeService.URL by calling the AutoDiscoverUrl. This will be sold and installed by many clients. Some of which use hosted Exchange. Meaning they will not control the update schedule of the Exchange Server. For this reason I am looking for a way to get the MS Exchange Version using the EWS API.

    Monday, January 17, 2011 9:36 PM

All replies

  • [partial duplicate of http://social.technet.microsoft.com/Forums/en-US/exchangesvrdevelopment/thread/8f00a496-cd47-4a67-a5f9-0bd21a678853]

    Hello Elfmanne,

    The topic Using Autodiscover to Get User Settings has an example of how to get this information. The setting you want is EwsSupportedSchemas.

    With regards,


    Michael | Microsoft Exchange SDK

    The Exchange Development Forum Guide has useful information for using the Exchange Development Forum.

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Monday, January 17, 2011 10:13 PM
    Moderator
  • Michael,

    I am getting an error going after this information.

     

    Error:

    "No appropriate Autodiscover SOAP or WS-Security endpoint is available."

     

    What does this mean? What can I do to correct it?? Also, do all versions support AutodiscoverService??? I thought I read somewhere that only 2010 supported it.

     

    Thanks

    Tuesday, January 18, 2011 5:31 PM
  • Elfmanne,

    I wasn't aware that you weren't using Exchange 2010. Please read the Exchange Development Forum Guide for guidance on posting to this forum. The more information upfront that you provide us, the easier it will be to give you an answer.

    Go ahead and make another call using the ExchangeService object. You can use any method that results in a call to the service. What we want is a successful (non HTTP error code) call that sends back an EWS response. The response should have the server version and therefore should update the ServerInfo property. At least that is what I think will happen.

    With regards,


    Michael | Microsoft Exchange SDK

    The Exchange Development Forum Guide has useful information for using the Exchange Development Forum.

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Tuesday, January 18, 2011 9:18 PM
    Moderator
  • I have something that works, however I would hope in the future that you would not have to supply the version that you are targeting.

     

    Private Sub AutodiscoverService(ByVal Username As String, ByVal Password As String, ByVal Email As String)
       Static dteToday As Date
    
       '+ We may not know what version we are sync'ing with
       Try
         '+ The goal here is to reset the _EXService once/day
         If dteToday = Nothing Then dteToday = Today()
    
         If _EXService.ServerInfo Is Nothing Or Not dteToday = Today() Then
          dteToday = Today()
    
          Dim EXVer As ExchangeVersion = ExchangeVersion.Exchange2010_SP1
    
          '+ Loop until we have a valid connection with exchange.
          '+ We need to connect with the proper version.
          Do Until EXVer = (ExchangeVersion.Exchange2007_SP1 - 1)
            _EXService = New ExchangeService(EXVer, TimeZoneInfo.Local)
            _EXService.Credentials = New WebCredentials(Username, Password, m_Domain)
    
            If _EXService.Url Is Nothing Then
             Try
               _EXService.AutodiscoverUrl(Email, AddressOf AutodiscoverServiceCallBack)
    
               '+ This is here because we need to know if we can successfully conect
               _EXService.SyncFolderItems(WellKnownFolderName.Contacts, PropertySet.FirstClassProperties, Nothing, _
                            1, SyncFolderItemsScope.NormalItems, DBNull.Value.ToString)
             Catch ex As ServiceVersionException
               ' Do Nothing - This will cause the loop to execute and try a different version
             Catch ex As Exception
               Throw ex
    
             End Try
            End If
    
            EXVer = CType(EXVer - 1, ExchangeVersion)
          Loop
         Else
          If _EXService.ServerInfo.VersionString Is Nothing Then
            _EXService = New ExchangeService(ExchangeVersion.Exchange2010_SP1, TimeZoneInfo.Local)
            AutodiscoverService(Username, Password, Email)
          End If
         End If
    
       Catch ex As Exception
         Throw ex
    
       End Try
    
      End Sub
    
    Thanks

    Wednesday, January 19, 2011 6:51 PM