Exemplo n.º 1
0
        // Token: 0x06001359 RID: 4953 RVA: 0x00077AAC File Offset: 0x00075CAC
        private static bool GetSearchFolderData(UserContext userContext, out int searchFolderItemCount, out SearchState searchState, out bool isRemoteSession)
        {
            searchFolderItemCount = -1;
            searchState           = SearchState.None;
            isRemoteSession       = false;
            bool result = false;

            if (userContext.SearchFolderId != null)
            {
                try
                {
                    using (SearchFolder searchFolder = SearchFolder.Bind(userContext.SearchFolderId.GetSession(userContext), userContext.SearchFolderId.StoreObjectId, SearchPerformanceData.searchFolderProperties))
                    {
                        object obj = searchFolder.TryGetProperty(FolderSchema.SearchFolderItemCount);
                        if (obj is int)
                        {
                            searchFolderItemCount = (int)obj;
                        }
                        searchState     = searchFolder.GetSearchCriteria().SearchState;
                        isRemoteSession = searchFolder.Session.IsRemote;
                    }
                    result = true;
                }
                catch (ObjectNotFoundException)
                {
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        // Token: 0x0600228D RID: 8845 RVA: 0x000C5B54 File Offset: 0x000C3D54
        public void ApplyFilter(SearchFolder folder, PropertyDefinition[] propertiesToLoad)
        {
            if (!this.IsCurrentVersion)
            {
                throw new OwaInvalidOperationException("Can't apply a filter in different version");
            }
            int num = 0;
            SearchFolderCriteria searchFolderCriteria = new SearchFolderCriteria(this.GetQueryFilter(), new StoreId[]
            {
                this.SourceFolderId.StoreObjectId
            });

            searchFolderCriteria.DeepTraversal = false;
            SearchPerformanceData searchPerformanceData = new SearchPerformanceData();
            string text = this.ToDescription();

            searchPerformanceData.StartSearch(string.IsNullOrEmpty(text) ? "No Search String" : text);
            IAsyncResult asyncResult = folder.BeginApplyContinuousSearch(searchFolderCriteria, null, null);
            Stopwatch    watch       = Utilities.StartWatch();
            bool         flag        = asyncResult.AsyncWaitHandle.WaitOne(5000, false);

            searchPerformanceData.Complete(!flag, true);
            if (flag)
            {
                folder.EndApplyContinuousSearch(asyncResult);
            }
            else
            {
                ExTraceGlobals.MailTracer.TraceDebug((long)this.GetHashCode(), "FolderVirtualListViewEventHandler.GetFilteredView. Search for filtered view timed out.");
                if (Globals.ArePerfCountersEnabled)
                {
                    OwaSingleCounters.SearchesTimedOut.Increment();
                }
            }
            OwaContext.Current.SearchPerformanceData = searchPerformanceData;
            Utilities.StopWatch(watch, "FolderVirtualListViewEventHandler.GetFilteredView (Wait for filter to complete)");
            object obj = folder.TryGetProperty(FolderSchema.ExtendedFolderFlags);

            if (!(obj is PropertyError))
            {
                num = (int)obj;
            }
            folder[FolderSchema.ExtendedFolderFlags] = (num | 4194304);
            folder.Save();
            folder.Load(propertiesToLoad);
        }