Ejemplo n.º 1
0
        internal static IEnumerable <StoreObjectId> GetSubfolders(IDiagnosticsSession tracer, Folder parentFolder, QueryFilter filter)
        {
            XsoUtil.< > c__DisplayClass6 CS$ < > 8__locals1 = new XsoUtil.< > c__DisplayClass6();
            CS$ < > 8__locals1.parentFolder = parentFolder;
            CS$ < > 8__locals1.filter       = filter;
            Util.ThrowOnNullArgument(CS$ < > 8__locals1.parentFolder, "parentFolder");
            Guid mailboxGuid = CS$ < > 8__locals1.parentFolder.Session.MailboxGuid;

            using (QueryResult queryResult = XsoUtil.TranslateXsoExceptionsWithReturnValue <QueryResult>(tracer, Strings.ConnectionToMailboxFailed(mailboxGuid), () => CS$ < > 8__locals1.parentFolder.FolderQuery(FolderQueryFlags.DeepTraversal, CS$ < > 8__locals1.filter, null, new PropertyDefinition[]
            {
                FolderSchema.Id
            })))
            {
                for (;;)
                {
                    object[][] folders = XsoUtil.TranslateXsoExceptionsWithReturnValue <object[][]>(tracer, Strings.ConnectionToMailboxFailed(mailboxGuid), () => queryResult.GetRows(10000));
                    if (folders == null || folders.Length == 0)
                    {
                        break;
                    }
                    foreach (object[] folderProps in folders)
                    {
                        if (folderProps[0] != null && !PropertyError.IsPropertyError(folderProps[0]))
                        {
                            yield return(StoreId.GetStoreObjectId((StoreId)folderProps[0]));
                        }
                    }
                }
            }
            yield break;
        }
Ejemplo n.º 2
0
            private object[][] GetRowsFromQuery(ref Folder folder, ref QueryResult result, TSort lastReturnedSortKey, int lastReturnedDocumentId)
            {
                QueryResult tempQueryResult = result;
                Folder      tempFolder      = folder;

                folder = null;
                result = null;
                object[][] result2;
                using (DisposeGuard disposeGuard = default(DisposeGuard))
                {
                    if (tempFolder == null)
                    {
                        tempFolder = XsoUtil.TranslateXsoExceptionsWithReturnValue <Folder>(this.diagnosticsSession, Strings.ConnectionToMailboxFailed(this.session.MailboxGuid), () => Folder.Bind(this.session, this.folderId));
                        if (tempFolder == null)
                        {
                            return(CrawlerItemIterator <TSort> .QueryResultWrapper.EmptyResult);
                        }
                        disposeGuard.Add <Folder>(tempFolder);
                        tempQueryResult = XsoUtil.TranslateXsoExceptionsWithReturnValue <QueryResult>(this.diagnosticsSession, Strings.ConnectionToMailboxFailed(this.session.MailboxGuid), XsoUtil.XsoExceptionHandlingFlags.DoNotExpectObjectNotFound, () => tempFolder.ItemQuery(ItemQueryType.None, null, this.sortOrder, this.propertiesToRequest));
                        if (tempQueryResult == null)
                        {
                            return(CrawlerItemIterator <TSort> .QueryResultWrapper.EmptyResult);
                        }
                        disposeGuard.Add <QueryResult>(tempQueryResult);
                        bool isSeekSuccessful = false;
                        XsoUtil.TranslateXsoExceptions(this.diagnosticsSession, Strings.ConnectionToMailboxFailed(this.session.MailboxGuid), XsoUtil.XsoExceptionHandlingFlags.DoNotExpectObjectNotFound | XsoUtil.XsoExceptionHandlingFlags.DoNotExpectCorruptData, delegate()
                        {
                            if (this.sortProperty == ItemSchema.DocumentId)
                            {
                                tempQueryResult.SeekToCondition(SeekReference.OriginBeginning, new ComparisonFilter(this.isAscending ? ComparisonOperator.GreaterThan : ComparisonOperator.LessThan, ItemSchema.DocumentId, lastReturnedSortKey), SeekToConditionFlags.None);
                            }
                            else
                            {
                                tempQueryResult.SeekToCondition(SeekReference.OriginBeginning, new OrFilter(new QueryFilter[]
                                {
                                    new AndFilter(new QueryFilter[]
                                    {
                                        new ComparisonFilter(this.isAscending ? ComparisonOperator.GreaterThanOrEqual : ComparisonOperator.LessThanOrEqual, this.sortProperty, lastReturnedSortKey),
                                        new ComparisonFilter(ComparisonOperator.GreaterThan, ItemSchema.DocumentId, lastReturnedDocumentId)
                                    }),
                                    new ComparisonFilter(this.isAscending ? ComparisonOperator.GreaterThan : ComparisonOperator.LessThan, this.sortProperty, lastReturnedSortKey)
                                }), SeekToConditionFlags.AllowExtendedFilters);
                            }
                            isSeekSuccessful = true;
                        });
                        if (!isSeekSuccessful)
                        {
                            return(CrawlerItemIterator <TSort> .QueryResultWrapper.EmptyResult);
                        }
                    }
                    else
                    {
                        disposeGuard.Add <Folder>(tempFolder);
                        disposeGuard.Add <QueryResult>(tempQueryResult);
                    }
                    object[][] array = XsoUtil.TranslateXsoExceptionsWithReturnValue <object[][]>(this.diagnosticsSession, Strings.ConnectionToMailboxFailed(this.session.MailboxGuid), XsoUtil.XsoExceptionHandlingFlags.DoNotExpectObjectNotFound | XsoUtil.XsoExceptionHandlingFlags.DoNotExpectCorruptData, () => tempQueryResult.GetRows(this.maxRowCount));
                    if (array == null)
                    {
                        result2 = CrawlerItemIterator <TSort> .QueryResultWrapper.EmptyResult;
                    }
                    else
                    {
                        if (this.canCacheResult)
                        {
                            folder = tempFolder;
                            result = tempQueryResult;
                            disposeGuard.Success();
                        }
                        result2 = array;
                    }
                }
                return(result2);
            }
Ejemplo n.º 3
0
 internal static TReturnValue TranslateXsoExceptionsWithReturnValue <TReturnValue>(IDiagnosticsSession tracer, LocalizedString errorString, Func <TReturnValue> xsoCall)
 {
     return(XsoUtil.TranslateXsoExceptionsWithReturnValue <TReturnValue>(tracer, errorString, XsoUtil.XsoExceptionHandlingFlags.None, xsoCall));
 }