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); }
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); }
public ASRequestParameter(TParameter parameter, ASRequestSettings settings) : base(parameter, settings) { }
protected ASCommandBase(TRequestBuilder parameters, ASRequestSettings settings) : base(new ASRequestParameter <TRequestBuilder>(parameters, settings)) { }