public override void Execute() { ExTraceGlobals.FrameworkTracer.TraceDebug <ADQueryList, int>((long)this.GetHashCode(), "{0} Execute() called for {1} addresses.", this, this.resultDictionary.Values.Count); this.budget.CheckOverBudget(); IRecipientSession adRecipientSession = this.GetRecipientSessionForOrganization(this.searchRoot, this.organizationId); Result <ADRecipient>[] adRecipientQueryResults = null; Guid[] archiveGuid; if (this.TryCreateExchangeGuidArray(out archiveGuid)) { RequestDetailsLoggerBase <RequestDetailsLogger> .Current.TrackLatency(ServiceLatencyMetadata.RequestedUserADLatency, delegate() { adRecipientQueryResults = this.FindByExchangeGuidsIncludingArchive(adRecipientSession, archiveGuid); }); } else { SmtpProxyAddress[] smtpProxyAddresses = this.CreateSmtpProxyAddressArray(); RequestDetailsLoggerBase <RequestDetailsLogger> .Current.TrackLatency(ServiceLatencyMetadata.RequestedUserADLatency, delegate() { adRecipientQueryResults = adRecipientSession.FindByProxyAddresses(smtpProxyAddresses); }); } this.SetQueryResults(adRecipientQueryResults); }
public static List <UserMailboxLocator> Instantiate(IRecipientSession adSession, params ProxyAddress[] proxyAddresses) { ArgumentValidator.ThrowIfNull("adSession", adSession); ArgumentValidator.ThrowIfNull("proxyAddresses", proxyAddresses); ArgumentValidator.ThrowIfZeroOrNegative("proxyAddresses.Length", proxyAddresses.Length); Result <ADUser>[] array = adSession.FindByProxyAddresses <ADUser>(proxyAddresses); List <UserMailboxLocator> list = new List <UserMailboxLocator>(proxyAddresses.Length); if (array == null) { MailboxLocator.Tracer.TraceDebug(0L, "UserMailboxLocator::Instantiate. FindByProxyAddresses returned no results"); return(null); } for (int i = 0; i < proxyAddresses.Length; i++) { Result <ADUser> result = array[i]; if (result.Data == null) { MailboxLocator.Tracer.TraceError <string, ProviderError>(0L, "UserMailboxLocator::Instantiate. FindByProxyAddresses returned error for address {0}. Error: {1}", proxyAddresses[i].ProxyAddressString, result.Error); throw new MailboxNotFoundException(ServerStrings.InvalidAddressError(proxyAddresses[i].ProxyAddressString)); } UserMailboxLocator userMailboxLocator = new UserMailboxLocator(adSession); userMailboxLocator.InitializeFromAd(result.Data); list.Add(userMailboxLocator); MailboxLocator.Tracer.TraceDebug <string, UserMailboxLocator>(0L, "UserMailboxLocator::Instantiate. FindByProxyAddresses found user. Address: {0}. Locator: {1}", proxyAddresses[i].ProxyAddressString, userMailboxLocator); } return(list); }
public IEnumerable <ADRecipient> ResolveProxyAddresses(IEnumerable <ProxyAddress> proxyAddresses) { if (proxyAddresses != null && proxyAddresses.Any <ProxyAddress>()) { IRecipientSession recipientSession = (IRecipientSession)this.CreateAdSession(); return(from recipient in recipientSession.FindByProxyAddresses(proxyAddresses.ToArray <ProxyAddress>()) select recipient.Data); } return(null); }
internal IEnumerable <string> Resolve(IEnumerable <string> addresses, IRecipientSession session) { if (addresses == null) { return(null); } int num = 0; List <ProxyAddress> list = new List <ProxyAddress>(); foreach (string text in addresses) { num++; if (!this.lookupCache.ContainsKey(text)) { list.Add(ProxyAddress.Parse(text)); this.lookupCache[text] = null; } } this.AddressesLookedUp = list.Count; if (list.Count > 0) { ProxyAddress[] array = list.ToArray(); Result <ADRawEntry>[] array2 = session.FindByProxyAddresses(array, BulkRecipientLookupCache.displayNameProperty); for (int i = 0; i < array.Length; i++) { ADRawEntry data = array2[i].Data; string addressString = array[i].AddressString; string value = null; if (data != null) { value = (data[ADRecipientSchema.DisplayName] as string); } if (string.IsNullOrEmpty(value)) { ProxyAddress proxyAddress; if (SmtpProxyAddress.TryDeencapsulate(array[i].AddressString, out proxyAddress) && !string.IsNullOrEmpty(proxyAddress.AddressString)) { value = proxyAddress.AddressString; } else { value = array[i].AddressString; } } this.lookupCache[addressString] = value; } } return(from address in addresses select this.lookupCache[address]); }
// Token: 0x06000C15 RID: 3093 RVA: 0x0004EEF0 File Offset: 0x0004D0F0 private RoutingAddress[] FilterByServerVersionAndLookupDisplayName(RoutingAddress[] routingAddresses, IRecipientSession recipientSession, string decisionMakerAddress, out string decisionMakerDisplayName) { List <RoutingAddress> list = new List <RoutingAddress>(routingAddresses.Length); ProxyAddress[] array = new ProxyAddress[routingAddresses.Length]; decisionMakerDisplayName = string.Empty; for (int i = 0; i < routingAddresses.Length; i++) { array[i] = new SmtpProxyAddress(routingAddresses[i].ToString(), true); } Result <ADRawEntry>[] array2 = recipientSession.FindByProxyAddresses(array, ApprovalAssistant.ExchangeVersionDisplayNameProperties); for (int j = 0; j < array2.Length; j++) { ADRawEntry data = array2[j].Data; if (data == null) { ApprovalAssistant.GeneralTracer.TraceDebug <RoutingAddress>((long)this.GetHashCode(), "AD entry not found for '{0}', will not send update to this address.", routingAddresses[j]); } else { ExchangeObjectVersion exchangeObjectVersion = (ExchangeObjectVersion)data[ADObjectSchema.ExchangeVersion]; if (exchangeObjectVersion != null && !exchangeObjectVersion.IsOlderThan(ExchangeObjectVersion.Exchange2010)) { list.Add(routingAddresses[j]); ProxyAddressCollection proxyAddressCollection = (ProxyAddressCollection)data[ADRecipientSchema.EmailAddresses]; foreach (ProxyAddress proxyAddress in proxyAddressCollection) { if (string.Equals(proxyAddress.AddressString, decisionMakerAddress, StringComparison.OrdinalIgnoreCase)) { decisionMakerDisplayName = (string)data[ADRecipientSchema.DisplayName]; } } } } } return(list.ToArray()); }
internal static HashSet <string> GetAllSmtpProxiesForRecipientFilters(ICollection <string> filters, IRecipientSession session) { HashSet <string> hashSet = null; if (filters == null || filters.Count == 0) { return(null); } int num = Math.Min(filters.Count, 256); List <ProxyAddress> list = new List <ProxyAddress>(num); foreach (string text in filters) { if (!string.IsNullOrEmpty(text) && SmtpAddress.IsValidSmtpAddress(text) && SmtpAddress.NullReversePath != (SmtpAddress)text) { ExTraceGlobals.TaskTracer.TraceDebug <string>(0L, "Adding filter '{0}' for proxy lookup.", text); list.Add(ProxyAddress.Parse(text)); if (list.Count > num) { ExTraceGlobals.TaskTracer.TraceDebug <int>(0L, "Not going to get proxy for all filters. Total number of filters is {0}.", filters.Count); break; } } } if (list.Count == 0) { ExTraceGlobals.TaskTracer.TraceDebug(0L, "No filters need to be looked up, none are addresses."); return(null); } ProxyAddress[] array = list.ToArray(); Result <ADRawEntry>[] array2 = session.FindByProxyAddresses(array, Utils.emailAddressesProperty); if (array2 == null) { return(null); } int i = 0; while (i < array2.Length) { Result <ADRawEntry> result = array2[i]; if (result.Data == null) { goto IL_1A5; } ProxyAddressCollection proxyAddressCollection = (ProxyAddressCollection)result.Data[ADRecipientSchema.EmailAddresses]; if (proxyAddressCollection != null) { using (MultiValuedProperty <ProxyAddress> .Enumerator enumerator2 = proxyAddressCollection.GetEnumerator()) { while (enumerator2.MoveNext()) { ProxyAddress proxyAddress = enumerator2.Current; if (ProxyAddressPrefix.Smtp.Equals(proxyAddress.Prefix) && !string.Equals(proxyAddress.AddressString, list[i].AddressString, StringComparison.OrdinalIgnoreCase)) { if (hashSet == null) { hashSet = new HashSet <string>(StringComparer.OrdinalIgnoreCase); } hashSet.Add(proxyAddress.AddressString); } } goto IL_1C2; } goto IL_1A5; } IL_1C2: i++; continue; IL_1A5: ExTraceGlobals.TaskTracer.TraceDebug <ProxyAddress, ProviderError>(0L, "{0} cannot be found up due to {1}.", array[i], result.Error); goto IL_1C2; } return(hashSet); }