// Token: 0x0600036D RID: 877 RVA: 0x00013CC0 File Offset: 0x00011EC0 private ABSession GetAddressBookSession() { if (this.addressBookSession == null) { IABSessionSettings sessionSettings = ABDiscoveryManager.GetSessionSettings(this.user.ExchangePrincipal, new int?(this.lcid), new ConsistencyMode?(ConsistencyMode.IgnoreInvalid), GlobalSettings.SyncLog, this.user.ClientSecurityContextWrapper.ClientSecurityContext); this.addressBookSession = ADABSession.Create(sessionSettings); } return(this.addressBookSession); }
public void Execute() { Command.CurrentCommand.ProtocolLogger.SetValue(ProtocolLoggerData.SearchQueryLength, this.searchQuery.Length); if (this.user.IsConsumerOrganizationUser) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "GalSearch command not supported for consumer users"); return; } if (this.minRange >= GlobalSettings.MaxGALSearchResults) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "GalSearch command min range specified is outside our configured maximum. No results will be returned"); return; } UnicodeCategory unicodeCategory = char.GetUnicodeCategory(this.searchQuery, 0); if (this.searchQuery.Length < GlobalSettings.MinGALSearchLength && unicodeCategory != UnicodeCategory.OtherLetter) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "GalSearch search string is shorter than MinGALSearchLength. No results will be returned"); Command.CurrentCommand.ProtocolLogger.SetValueIfNotSet(ProtocolLoggerData.Error, "SearchStringTooShort"); return; } OperationRetryManagerResult operationRetryManagerResult = GalSearchProvider.retryManager.TryRun(delegate { IABSessionSettings sessionSettings = ABDiscoveryManager.GetSessionSettings(this.user.ExchangePrincipal, new int?(this.lcid), null, GlobalSettings.SyncLog, this.user.ClientSecurityContextWrapper.ClientSecurityContext); using (ABSession absession = ADABSession.Create(sessionSettings)) { this.addressBookObjects = absession.FindByANR(this.searchQuery, GlobalSettings.MaxGALSearchResults); } }); if (operationRetryManagerResult.Succeeded) { if (this.pictureOptions != null && this.user.Features.IsEnabled(EasFeature.HDPhotos) && this.user.Context.Request.Version >= 160) { this.photoRetriever = new AirSyncPhotoRetriever(this.user.Context); List <string> list = new List <string>(); int num = this.minRange; while (this.addressBookObjects != null && num <= this.maxRange && num < this.addressBookObjects.Count) { ABObject abobject = this.addressBookObjects[num]; if (abobject == null) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "ABSession.FindByAnr returned null addresBookObject. Continue."); } else { ABContact abcontact = abobject as ABContact; if (abcontact == null) { AirSyncDiagnostics.TraceDebug(ExTraceGlobals.RequestsTracer, this, "ABSession.FindByAnr returned object that is not a \"ABContact\". Continue."); } else { list.Add(abcontact.EmailAddress); } } num++; } this.photoRetriever.BeginGetThumbnailPhotoFromMailbox(list, this.pictureOptions.PhotoSize); } return; } if (operationRetryManagerResult.Exception is ABSubscriptionDisabledException) { throw new AirSyncPermanentException(StatusCode.Sync_InvalidSyncKey, operationRetryManagerResult.Exception, false) { ErrorStringForProtocolLogger = "ABSubsDisabled" }; } if (operationRetryManagerResult.Exception is DataValidationException) { throw new AirSyncPermanentException(StatusCode.Sync_InvalidSyncKey, operationRetryManagerResult.Exception, false) { ErrorStringForProtocolLogger = "BadADDataInGalSearch" }; } if (operationRetryManagerResult.Exception is DataSourceOperationException) { throw new AirSyncPermanentException(StatusCode.Sync_InvalidSyncKey, operationRetryManagerResult.Exception, false) { ErrorStringForProtocolLogger = "BadADDataSource" }; } if (operationRetryManagerResult.Exception != null) { throw operationRetryManagerResult.Exception; } throw new InvalidOperationException("GalSearch failed with result code: " + operationRetryManagerResult.ResultCode); }