Exemple #1
0
        public static QueryFilter GetSourceFilter(SearchSource source)
        {
            switch (source.SourceType)
            {
            case SourceType.LegacyExchangeDN:
                if (source.CanBeCrossPremise)
                {
                    return(new OrFilter(new QueryFilter[]
                    {
                        new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.LegacyExchangeDN, source.ReferenceId),
                        new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.EmailAddresses, "x500:" + source.ReferenceId)
                    }));
                }
                return(new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.LegacyExchangeDN, source.ReferenceId));

            case SourceType.Recipient:
                return(SearchRecipient.SearchRecipientIdParameter.GetFilter(source.ReferenceId));

            case SourceType.MailboxGuid:
            {
                Guid guid;
                if (Guid.TryParse(source.ReferenceId, out guid))
                {
                    return(new ComparisonFilter(ComparisonOperator.Equal, ADMailboxRecipientSchema.ExchangeGuid, guid));
                }
                break;
            }
            }
            return(null);
        }
Exemple #2
0
 private MailboxInfo FindMailboxInfo(object state)
 {
     Recorder.Trace(4L, TraceType.InfoTrace, "SearchMailboxesResults.FindMailboxInfo State:", state);
     if (this.sources != null && this.sources.Count > 0)
     {
         Recorder.Trace(4L, TraceType.InfoTrace, "SearchMailboxesResults.FindMailboxInfo Count:", this.sources.Count);
         SearchSource      searchSource = null;
         SearchPreviewItem previewItem  = state as SearchPreviewItem;
         if (previewItem != null)
         {
             searchSource = this.Sources.FirstOrDefault((SearchSource t) => string.Equals(t.OriginalReferenceId, previewItem.Mailbox.MailboxId, StringComparison.InvariantCultureIgnoreCase) || string.Equals(t.ReferenceId, previewItem.Mailbox.MailboxId, StringComparison.InvariantCultureIgnoreCase));
         }
         FailedSearchMailbox failedItem = state as FailedSearchMailbox;
         if (failedItem != null)
         {
             searchSource = this.Sources.FirstOrDefault((SearchSource t) => string.Equals(t.OriginalReferenceId, failedItem.Mailbox, StringComparison.InvariantCultureIgnoreCase) || string.Equals(t.ReferenceId, failedItem.Mailbox, StringComparison.InvariantCultureIgnoreCase));
         }
         MailboxStatisticsItem statisticsItem = state as MailboxStatisticsItem;
         if (statisticsItem != null)
         {
             searchSource = this.Sources.FirstOrDefault((SearchSource t) => string.Equals(t.OriginalReferenceId, statisticsItem.MailboxId, StringComparison.InvariantCultureIgnoreCase) || string.Equals(t.ReferenceId, statisticsItem.MailboxId, StringComparison.InvariantCultureIgnoreCase));
         }
         if (searchSource != null)
         {
             return(searchSource.MailboxInfo);
         }
     }
     Recorder.Trace(4L, TraceType.WarningTrace, "SearchMailboxesResults.FindMailboxInfo Source Not Found State:", state);
     return(null);
 }
        public SearchSource Clone()
        {
            SearchSource searchSource = (SearchSource)base.MemberwiseClone();

            searchSource.ExtendedAttributes = new SearchSource.ExtendedAttributeStore(this.ExtendedAttributes);
            searchSource.MailboxInfo        = null;
            return(searchSource);
        }
 public static SourceType GetSourceType(SearchSource source)
 {
     if (string.IsNullOrEmpty(source.ReferenceId))
     {
         return(source.SourceType);
     }
     if (source.ReferenceId.StartsWith("/", StringComparison.InvariantCultureIgnoreCase) && (source.ReferenceId.IndexOf("o=", StringComparison.InvariantCultureIgnoreCase) != -1 || source.ReferenceId.IndexOf("ou=", StringComparison.InvariantCultureIgnoreCase) != -1 || source.ReferenceId.IndexOf("cn=", StringComparison.InvariantCultureIgnoreCase) != -1))
     {
         return(SourceType.LegacyExchangeDN);
     }
     if (source.ReferenceId.StartsWith("\\", StringComparison.InvariantCultureIgnoreCase))
     {
         return(SourceType.PublicFolder);
     }
     return(SourceType.Recipient);
 }
Exemple #5
0
        public void UpdateResults(IEnumerable <FanoutParameters> parameters, SearchMailboxesInputs input, SearchMailboxesResponse response, Exception exception)
        {
            Recorder.Trace(4L, TraceType.InfoTrace, new object[]
            {
                "SearchMailboxesResults.UpdateResults Parameters:",
                parameters,
                "Input:",
                input,
                "Response:",
                response,
                "Exception:",
                exception
            });
            this.AddSources(from t in parameters
                            select t.Source);
            using (WebServiceMailboxSearchGroup webServiceMailboxSearchGroup = new WebServiceMailboxSearchGroup(parameters.First <FanoutParameters>().GroupId, new WebServiceMailboxSearchGroup.FindMailboxInfoHandler(this.FindMailboxInfo), input.Criteria, input.PagingInfo, input.CallerInfo))
            {
                if (exception == null && (response.SearchResult == null || response.Result == 2))
                {
                    exception = new ServiceResponseException(response);
                }
                if (exception != null)
                {
                    using (IEnumerator <SearchSource> enumerator = this.Sources.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            SearchSource searchSource = enumerator.Current;
                            if (searchSource.MailboxInfo != null)
                            {
                                webServiceMailboxSearchGroup.MergeMailboxResult(searchSource.MailboxInfo, exception);
                            }
                        }
                        goto IL_10D;
                    }
                }
                if (response.SearchResult != null)
                {
                    webServiceMailboxSearchGroup.MergeSearchResults(response.SearchResult);
                }
IL_10D:
                this.SearchResult = webServiceMailboxSearchGroup.GetResultAggregator();
            }
        }