Beispiel #1
0
        public async Task <string> GetAutoDiscoveredServer()
        {
            foreach (var serverUri in AvailableServers)
            {
                this.settings = new ASRequestSettings(serverUri, this.settings.Login, this.settings.Password, this.settings.ProtocolVersion, this.settings.UseSSL, this.settings.DeviceId, this.settings.DeviceType, this.settings.PolicyKey);
                try
                {
                    FolderSyncCommandResult result = await this.FolderSync("0");

                    if (!string.IsNullOrEmpty(result.SyncKey))
                    {
                        if (!string.IsNullOrEmpty(this.settings.HostName))
                        {
                            return(this.settings.HostName);
                        }

                        return(serverUri);
                    }
                }
                catch (CommandException)
                {
                    // do nothing and try the next server
                }
            }

            // didn't find any server to handle current credentials
            return(null);
        }
Beispiel #2
0
        public ActiveSyncServer(string serverName, string login, string password, string deviceId, uint policyKey)
        {
            if (string.IsNullOrEmpty(login))
            {
                throw new ArgumentNullException(nameof(login));
            }
            if (string.IsNullOrEmpty(password))
            {
                throw new ArgumentNullException(nameof(password));
            }
            if (string.IsNullOrEmpty(deviceId))
            {
                throw new ArgumentNullException(nameof(deviceId));
            }

            if (deviceId.Length > 32)
            {
                deviceId = deviceId.Substring(deviceId.Length - 32, 32);
            }

            this.settings = new ASRequestSettings(serverName, login, password, ProtocolVersion, UseSSL, deviceId, DeviceType, policyKey);
        }
Beispiel #3
0
 public ASRequestParameter(TParameter parameter, ASRequestSettings settings)
     : base(parameter, settings)
 {
 }
Beispiel #4
0
 protected ASCommandBase(TRequestBuilder parameters, ASRequestSettings settings)
     : base(new ASRequestParameter <TRequestBuilder>(parameters, settings))
 {
 }