/// <summary>
 /// Attempt a simple request to ConvertIds to see if this service configuration finds an Exchange
 /// server that can handle the requested schema.
 /// </summary>
 /// <param name="service">The ExchangeService configuration to test.</param>
 public static void TestExchangeService(this ExchangeService service)
 {
     // mstehle - 11/15/2011 - The validation override is now handled by GlobalSettings, no need
     // to do all this stuff anymore.  Just try ConvertIds and let the exceptions bubble up.
     service.ConvertIds(
         new AlternateId[] { new AlternateId(IdFormat.HexEntryId, "00", "*****@*****.**") },
         IdFormat.HexEntryId);
 }
Esempio n. 2
0
 //private void InitializeWithDefaults()
 //{
 //    InitializeWithDefaults(null, null, null);
 //}
 ///// <summary>
 ///// Create a service binding based off of default credentials,
 ///// the assumed root folder, and an assumed autodiscover email address
 ///// </summary>
 ///// <param name="version">EWS schema version to use.  Passing NULL uses the
 ///// EWS Managed API default value.</param>
 ///// <param name="ewsUrl">URL to EWS endpoint.  Passing NULL or an empty string
 ///// results in a call to Autodiscover</param>
 ///// <param name="autodiscoverAddress">Email address to use for Autodiscover.
 ///// Passing NULL or an empty string results in a ActiveDirectory querying.</param>
 ///// <returns>A new instance of an ExchangeService</returns>
 //private void InitializeWithDefaults(ExchangeVersion? version, Uri ewsUrl, string autodiscoverAddress)
 //{
 //    RequestedExchangeVersion = version;
 //    UseDefaultCredentials = true;
 //    // If the EWS URL is not specified, use Autodiscover to find it
 //    if (ewsUrl == null)
 //    {
 //        // If no email address was given to use with Autodiscover, attempt
 //        // to look it up in Active Directory
 //        if (String.IsNullOrEmpty(autodiscoverAddress))
 //        {
 //            autodiscoverAddress = ActiveDirectoryHelper.GetPrimarySmtp(
 //                System.Security.Principal.WindowsIdentity.GetCurrent().Name);
 //        }
 //        DoAutodiscover(autodiscoverAddress);
 //    }
 //    else
 //    {
 //        EwsUrl = ewsUrl;
 //    }
 //    try
 //    {
 //        CreateExchangeService().TestExchangeService();
 //    }
 //    catch (ServiceVersionException ex)
 //    {
 //        LogFactory.LogInstance().WriteLog(LogLevel.ERR, ex.Message, "Initial requested version of {0} didn't work,detail:{1}", Enum.GetName(typeof(ExchangeVersion), version), ex.StackTrace);
 //        // Pass the autodiscover email address and URL if we've already looked those up
 //        //InitializeWithDefaults(ExchangeVersion.Exchange2007_SP1, EwsUrl, autodiscoverAddress);
 //    }
 //}
 public static void TestExchangeService(ExchangeService service)
 {
     // mstehle - 11/15/2011 - The validation override is now handled by GlobalSettings, no need
     // to do all this stuff anymore.  Just try ConvertIds and let the exceptions bubble up.
     service.ConvertIds(
         new AlternateId[] { new AlternateId(IdFormat.HexEntryId, "00", "*****@*****.**") },
         IdFormat.HexEntryId);
 }