public IWebServiceBinding GetEwsBinding(DirectoryContext directoryContext)
        {
            IClientProxy clientProxy;

            switch (base.TrackingAuthorityKind)
            {
            case TrackingAuthorityKind.RemoteSiteInCurrentOrg:
            {
                ExchangeServiceBinding exchangeServiceBinding = new ExchangeServiceBinding("MessageTracking", WebServiceTrackingAuthority.noValidationCallback);
                this.SetAuthenticationMechanism(exchangeServiceBinding);
                exchangeServiceBinding.Proxy = new WebProxy();
                RemoteSiteInCurrentOrgTrackingAuthority remoteSiteInCurrentOrgTrackingAuthority = (RemoteSiteInCurrentOrgTrackingAuthority)this;
                exchangeServiceBinding.Url       = this.Uri.ToString();
                exchangeServiceBinding.UserAgent = WebServiceTrackingAuthority.EwsUserAgentString;
                exchangeServiceBinding.RequestServerVersionValue         = new RequestServerVersion();
                exchangeServiceBinding.RequestServerVersionValue.Version = VersionConverter.GetExchangeVersionType(remoteSiteInCurrentOrgTrackingAuthority.ServerVersion);
                exchangeServiceBinding.CookieContainer = new CookieContainer();
                clientProxy = new ClientProxyEWS(exchangeServiceBinding, this.Uri, remoteSiteInCurrentOrgTrackingAuthority.ServerVersion);
                break;
            }

            case TrackingAuthorityKind.RemoteForest:
                clientProxy = new ClientProxyRD(directoryContext, this.ProxyRecipient, this.Domain, ExchangeVersion.Exchange2010);
                break;

            case TrackingAuthorityKind.RemoteTrustedOrg:
                clientProxy = new ClientProxyRD(directoryContext, this.ProxyRecipient, this.Domain, ExchangeVersion.Exchange2010_SP1);
                break;

            default:
                throw new NotImplementedException();
            }
            return(new WebServiceBinding(clientProxy, directoryContext, this));
        }
        public static Microsoft.Exchange.InfoWorker.Common.Availability.Proxy.ExchangeVersionType GetRdExchangeVersionType(int serverVersion)
        {
            switch (VersionConverter.GetExchangeVersionType(serverVersion))
            {
            case Microsoft.Exchange.SoapWebClient.EWS.ExchangeVersionType.Exchange2010:
                return(Microsoft.Exchange.InfoWorker.Common.Availability.Proxy.ExchangeVersionType.Exchange2010);

            case Microsoft.Exchange.SoapWebClient.EWS.ExchangeVersionType.Exchange2010_SP1:
                return(Microsoft.Exchange.InfoWorker.Common.Availability.Proxy.ExchangeVersionType.Exchange2010_SP1);

            case Microsoft.Exchange.SoapWebClient.EWS.ExchangeVersionType.Exchange2013:
                return(Microsoft.Exchange.InfoWorker.Common.Availability.Proxy.ExchangeVersionType.Exchange2012);
            }
            throw new InvalidOperationException("Unexpected version type.");
        }
 public static void Convert(Microsoft.Exchange.SoapWebClient.EWS.GetMessageTrackingReportRequestType request, int version)
 {
     Microsoft.Exchange.SoapWebClient.EWS.ExchangeVersionType exchangeVersionType  = VersionConverter.GetExchangeVersionType(version);
     Microsoft.Exchange.SoapWebClient.EWS.ExchangeVersionType exchangeVersionType2 = exchangeVersionType;
     if (exchangeVersionType2 == Microsoft.Exchange.SoapWebClient.EWS.ExchangeVersionType.Exchange2010)
     {
         request.Properties = null;
         return;
     }
     if (request.Properties != null && request.Properties.Length == 0)
     {
         request.Properties = null;
     }
 }
 public static void Convert(Microsoft.Exchange.SoapWebClient.EWS.FindMessageTrackingReportRequestType request, int version)
 {
     Microsoft.Exchange.SoapWebClient.EWS.ExchangeVersionType exchangeVersionType  = VersionConverter.GetExchangeVersionType(version);
     Microsoft.Exchange.SoapWebClient.EWS.ExchangeVersionType exchangeVersionType2 = exchangeVersionType;
     if (exchangeVersionType2 == Microsoft.Exchange.SoapWebClient.EWS.ExchangeVersionType.Exchange2010)
     {
         TrackingExtendedProperties trackingExtendedProperties = TrackingExtendedProperties.CreateFromTrackingPropertyArray(request.Properties);
         Options options = new Options(VersionConverter.BasicDiagnostics.Equals(request.DiagnosticsLevel, StringComparison.Ordinal), trackingExtendedProperties.ExpandTree, trackingExtendedProperties.SearchAsRecip, request.ServerHint);
         request.DiagnosticsLevel = options.ToString();
         request.ServerHint       = null;
         request.Properties       = null;
         return;
     }
     if (request.Properties != null && request.Properties.Length == 0)
     {
         request.Properties = null;
     }
 }