public IEnumerable <FanoutParameters> GetServer(ISearchPolicy policy, IEnumerable <SearchSource> sources) { Recorder.Trace(5L, TraceType.InfoTrace, "AutoDiscoveryServerProvider.GetServer Sources:", sources); long discoveryTimeLocal = 0L; long discoveryTimeCrossPremise = 0L; IEwsEndpointDiscovery endpointDiscovery = Factory.Current.GetEwsEndpointDiscovery((from t in sources select t.MailboxInfo).ToList <MailboxInfo>(), policy.RecipientSession.SessionSettings.CurrentOrganizationId, policy.CallerInfo); Dictionary <GroupId, List <MailboxInfo> > mailboxServerMap = endpointDiscovery.FindEwsEndpoints(out discoveryTimeLocal, out discoveryTimeCrossPremise); foreach (GroupId key in mailboxServerMap.Keys) { using (List <MailboxInfo> .Enumerator enumerator2 = mailboxServerMap[key].GetEnumerator()) { while (enumerator2.MoveNext()) { MailboxInfo mailbox = enumerator2.Current; FanoutParameters fanoutParameters = new FanoutParameters(); fanoutParameters.GroupId = key; fanoutParameters.Source = sources.FirstOrDefault((SearchSource t) => t.MailboxInfo == mailbox); yield return(fanoutParameters); } } } yield break; }
protected void PerformMailboxDiscovery(ADRawEntry adRawEntry, MailboxType mailboxType, out GroupId groupId, out MailboxInfo mailboxInfo) { List <MailboxInfo> list = new List <MailboxInfo>(1); list.Add(new MailboxInfo(adRawEntry, mailboxType)); IEwsEndpointDiscovery ewsEndpointDiscovery = Factory.Current.GetEwsEndpointDiscovery(list, this.orgId, this.callerInfo); long num = 0L; long num2 = 0L; Dictionary <GroupId, List <MailboxInfo> > source = ewsEndpointDiscovery.FindEwsEndpoints(out num, out num2); KeyValuePair <GroupId, List <MailboxInfo> > keyValuePair = source.First <KeyValuePair <GroupId, List <MailboxInfo> > >(); groupId = keyValuePair.Key; mailboxInfo = keyValuePair.Value[0]; }
public IAsyncResult BeginSearch(AsyncCallback callback, object state) { if (MultiMailboxSearch.SearchState.Running == this.searchState) { return(this.asyncResult); } if (this.asyncResult != null) { this.asyncResult.Dispose(); this.asyncResult = null; } this.asyncResult = new AsyncResult(callback, state); this.searchState = MultiMailboxSearch.SearchState.Running; this.IncrementPerfCounters(); IEwsEndpointDiscovery ewsEndpointDiscovery = Factory.Current.GetEwsEndpointDiscovery(this.mailboxes, this.orgId, this.callerInfo); long num = 0L; long num2 = 0L; Dictionary <GroupId, List <MailboxInfo> > mailboxGroups = ewsEndpointDiscovery.FindEwsEndpoints(out num, out num2); this.resultAggregator.ProtocolLog.Add("LocalMailboxMappingTime", num); this.resultAggregator.ProtocolLog.Add("AutodiscoverTime", num2); this.StartGroupSearches(mailboxGroups); return(this.asyncResult); }