protected override void InternalExecuteSearchWebService() { GetNonIndexableItemDetailsParameters parameters = new GetNonIndexableItemDetailsParameters { Mailboxes = new string[] { this.mailboxInfo.LegacyExchangeDN }, SearchArchiveOnly = !this.mailboxInfo.IsPrimary, PageSize = new int?(this.pagingInfo.PageSize), PageItemReference = this.pagingInfo.PageItemReference }; IAsyncResult result = this.ewsClient.BeginGetNonIndexableItemDetails(null, null, parameters); GetNonIndexableItemDetailsResponse getNonIndexableItemDetailsResponse = this.ewsClient.EndGetNonIndexableItemDetails(result); if (getNonIndexableItemDetailsResponse.NonIndexableItemsResult != null) { if (getNonIndexableItemDetailsResponse.NonIndexableItemsResult.Items != null && getNonIndexableItemDetailsResponse.NonIndexableItemsResult.Items.Length > 0) { List <NonIndexableItem> nonIndexableItems = NonIndexableItemDetailsProvider.ConvertFromWebServiceFailedItemsCollection(getNonIndexableItemDetailsResponse.NonIndexableItemsResult.Items); this.UpdateResults(nonIndexableItems); } if (getNonIndexableItemDetailsResponse.NonIndexableItemsResult.FailedMailboxes != null && getNonIndexableItemDetailsResponse.NonIndexableItemsResult.FailedMailboxes.Length > 0) { foreach (FailedSearchMailbox failedSearchMailbox in getNonIndexableItemDetailsResponse.NonIndexableItemsResult.FailedMailboxes) { base.AddFailedMailbox(failedSearchMailbox.Mailbox, failedSearchMailbox.ErrorMessage); } } } }
private void RetrieveFailedItems(ADRawEntry adRawEntry, MailboxType mailboxType) { base.PerformMailboxDiscovery(adRawEntry, mailboxType, out this.groupId, out this.mailboxInfo); switch (this.groupId.GroupType) { case GroupType.CrossServer: case GroupType.CrossPremise: base.ExecuteSearchWebService(); return; case GroupType.SkippedError: { string error = (this.groupId.Error == null) ? string.Empty : this.groupId.Error.Message; base.AddFailedMailbox(this.mailboxInfo.LegacyExchangeDN, error); return; } default: if (this.mailboxInfo.MailboxGuid != Guid.Empty) { Guid guid = (mailboxType == MailboxType.Archive) ? this.mailboxInfo.ArchiveDatabase : this.mailboxInfo.MdbGuid; string indexSystemName = FastIndexVersion.GetIndexSystemName(guid); using (IFailedItemStorage failedItemStorage = Factory.Current.CreateFailedItemStorage(Factory.Current.CreateSearchServiceConfig(), indexSystemName)) { List <NonIndexableItem> nonIndexableItems = new List <NonIndexableItem>(); NonIndexableItemDetailsProvider.AddFailedItemsToCollection(failedItemStorage, this.mailboxInfo.MailboxGuid, this.GetReferenceDocId(), this.pagingInfo.PageSize, nonIndexableItems); this.UpdateResults(nonIndexableItems); } } return; } }
private void UpdateResults(List <NonIndexableItem> nonIndexableItems) { this.Results = NonIndexableItemDetailsProvider.MergeFailedItemsCollection(this.Results, nonIndexableItems, this.pagingInfo.PageSize); }
private static List <NonIndexableItem> MergeFailedItemsCollection(List <NonIndexableItem> firstCollection, List <NonIndexableItem> secondCollection, int pageSize) { if (firstCollection == null || firstCollection.Count == 0) { return(NonIndexableItemDetailsProvider.CreateCollectionOfFailedItems(secondCollection, pageSize)); } if (secondCollection == null || secondCollection.Count == 0) { return(NonIndexableItemDetailsProvider.CreateCollectionOfFailedItems(firstCollection, pageSize)); } List <NonIndexableItem> list; if (pageSize == 2147483647) { list = new List <NonIndexableItem>(); } else { list = new List <NonIndexableItem>(pageSize); } int num = 0; int num2 = 0; int num3 = 0; do { NonIndexableItem nonIndexableItem; if (num < firstCollection.Count) { nonIndexableItem = firstCollection[num]; } else { nonIndexableItem = null; } NonIndexableItem nonIndexableItem2; if (num2 < secondCollection.Count) { nonIndexableItem2 = secondCollection[num2]; } else { nonIndexableItem2 = null; } if (nonIndexableItem == null && nonIndexableItem2 == null) { break; } if (nonIndexableItem == null) { list.Add(nonIndexableItem2); num2++; } else if (nonIndexableItem2 == null) { list.Add(nonIndexableItem); num++; } else { long num4; long.TryParse(nonIndexableItem.SortValue, out num4); long num5; long.TryParse(nonIndexableItem2.SortValue, out num5); if (num4 <= num5) { list.Add(nonIndexableItem); num++; } else { list.Add(nonIndexableItem2); num2++; } } }while (++num3 < pageSize); return(list); }