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();
         }
     }
 }
Beispiel #2
0
        // Token: 0x06000F5B RID: 3931 RVA: 0x0003B67C File Offset: 0x0003987C
        public static ConversationType[] GetConversationDataFromSearchFolder(OwaSearchContext searchContext, MailboxSession mailboxSession, out int totalItemCount)
        {
            totalItemCount = 0;
            List <ConversationType> list = new List <ConversationType>(50);
            StoreId searchFolderId       = searchContext.SearchFolderId;

            SortBy[] searchSortBy = searchContext.SearchSortBy;
            using (SearchFolder searchFolder = SearchFolder.Bind(mailboxSession, searchFolderId))
            {
                int rowCount = 25;
                using (QueryResult queryResult = searchFolder.ConversationItemQuery(null, searchSortBy, SearchFolderConversationRetriever.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 (totalItemCount < 50)
                            {
                                ConversationType conversationFromDataRow = SearchFolderConversationRetriever.GetConversationFromDataRow(searchContext, mailboxSession, rows[i], SearchFolderConversationRetriever.itemSearchPropertyDefinitionsOrderDictionary);
                                list.Add(conversationFromDataRow);
                            }
                            totalItemCount++;
                        }
                    }
                }
            }
            return(list.ToArray());
        }