Beispiel #1
0
        // Token: 0x06000F5F RID: 3935 RVA: 0x0003BBE0 File Offset: 0x00039DE0
        public static ItemType[] GetItemDataFromSearchFolder(OwaSearchContext searchContext, MailboxSession mailboxSession, out int totalRowCount)
        {
            List <ItemType> list = new List <ItemType>(50);

            totalRowCount = 0;
            StoreId searchFolderId = searchContext.SearchFolderId;

            SortBy[] searchSortBy = searchContext.SearchSortBy;
            using (SearchFolder searchFolder = SearchFolder.Bind(mailboxSession, searchFolderId))
            {
                int rowCount = 25;
                using (QueryResult queryResult = searchFolder.ItemQuery(ItemQueryType.None, null, searchSortBy, SearchFolderItemDataRetriever.itemSearchPropertyDefinitions))
                {
                    bool flag = true;
                    while (flag)
                    {
                        object[][] rows = queryResult.GetRows(rowCount, out flag);
                        if (rows == null || rows.Length == 0)
                        {
                            break;
                        }
                        for (int i = 0; i < rows.Length; i++)
                        {
                            if (totalRowCount < 50)
                            {
                                ItemType itemFromDataRow = SearchFolderItemDataRetriever.GetItemFromDataRow(searchContext, mailboxSession, rows[i], SearchFolderItemDataRetriever.itemSearchPropertyDefinitionsOrderDictionary);
                                list.Add(itemFromDataRow);
                            }
                            totalRowCount++;
                        }
                    }
                }
            }
            return(list.ToArray());
        }
 private static void FillItemDataInPayload(IMailboxContext userContext, OwaSearchContext searchContext, SearchNotificationPayload payload)
 {
     try
     {
         userContext.LockAndReconnectMailboxSession(3000);
         int serverSearchResultsRowCount = 0;
         if (searchContext.SearchContextType == SearchContextType.ItemSearch)
         {
             payload.MessageItems = SearchFolderItemDataRetriever.GetItemDataFromSearchFolder(searchContext, userContext.MailboxSession, out serverSearchResultsRowCount);
         }
         else if (searchContext.SearchContextType == SearchContextType.ConversationSearch)
         {
             payload.Conversations = SearchFolderConversationRetriever.GetConversationDataFromSearchFolder(searchContext, userContext.MailboxSession, out serverSearchResultsRowCount);
         }
         payload.ServerSearchResultsRowCount = serverSearchResultsRowCount;
     }
     catch (OwaLockTimeoutException ex)
     {
         ExTraceGlobals.CoreCallTracer.TraceError <string>(0L, "User context lock timed out in FillItemDataInPayload. Exception: {0}", ex.Message);
     }
     finally
     {
         if (userContext.MailboxSessionLockedByCurrentThread())
         {
             userContext.UnlockAndDisconnectMailboxSession();
         }
     }
 }