Exemplo n.º 1
0
 protected MailboxSearchGroup(MailboxInfo[] mailboxes, SearchCriteria searchCriteria, PagingInfo pagingInfo, CallerInfo executingUser)
 {
     this.mailboxes        = mailboxes;
     this.searchCriteria   = searchCriteria;
     this.pagingInfo       = pagingInfo;
     this.executingUser    = executingUser;
     this.resultAggregator = new ResultAggregator();
 }
Exemplo n.º 2
0
        private static UniqueItemHash CalculateUniqueItemHash(StoreSession mailboxSession, object[] row, PagingInfo pagingInfo, StoreId sentItemsFolderId)
        {
            UniqueItemHash result = null;
            Dictionary <PropertyDefinition, object> dictionary = new Dictionary <PropertyDefinition, object>(4);
            int num = 0;

            foreach (PropertyDefinition key in pagingInfo.DataColumns)
            {
                dictionary.Add(key, row[num]);
                num++;
            }
            object obj  = null;
            object obj2 = null;
            object obj3 = null;
            object obj4 = null;
            object obj5 = null;
            object obj6 = null;
            object obj7 = null;

            dictionary.TryGetValue(ItemSchema.Id, out obj);
            dictionary.TryGetValue(StoreObjectSchema.ParentItemId, out obj2);
            dictionary.TryGetValue(ItemSchema.InternetMessageId, out obj3);
            dictionary.TryGetValue(ItemSchema.ConversationId, out obj4);
            dictionary.TryGetValue(ItemSchema.ConversationTopic, out obj5);
            dictionary.TryGetValue(ItemSchema.BodyTag, out obj6);
            dictionary.TryGetValue(StoreObjectSchema.ItemClass, out obj7);
            if (obj != null && obj2 != null && obj3 != null && obj4 != null && obj5 != null)
            {
                StoreId storeId       = (StoreId)obj;
                string  internetMsgId = obj3 as string;
                string  text          = obj5 as string;
                StoreId storeId2      = obj2 as StoreId;
                bool    flag          = storeId2 != null && sentItemsFolderId != null && storeId2.Equals(sentItemsFolderId);
                if (obj6 == null && !flag && ObjectClass.IsMessage(obj7 as string, false))
                {
                    using (Item item = Item.Bind(mailboxSession, storeId))
                    {
                        if (item.Body != null)
                        {
                            obj6 = item.Body.CalculateBodyTag();
                        }
                    }
                }
                byte[] array = obj6 as byte[];
                result = new UniqueItemHash(internetMsgId, text ?? string.Empty, (array != null) ? BodyTagInfo.FromByteArray(array) : null, flag);
            }
            return(result);
        }
Exemplo n.º 3
0
 internal static PreviewItem[] CreateSearchPreviewItems(MailboxInfo mailboxInfo, object[][] rows, StoreSession mailboxSession, PagingInfo pagingInfo)
 {
     Util.ThrowOnNull(rows, "rows");
     return(Util.InternalCreateSearchPreviewItems(mailboxInfo, rows, pagingInfo, mailboxSession, null, true));
 }
Exemplo n.º 4
0
        private static PreviewItem[] InternalCreateSearchPreviewItems(MailboxInfo mailboxInfo, object[][] rows, PagingInfo pagingInfo, StoreSession mailboxSession, List <KeyValuePair <int, long> > messageIdPairs, bool usingSearchFolders)
        {
            if (!usingSearchFolders)
            {
                Util.ThrowOnNull(messageIdPairs, "messageIdPairs");
            }
            if (rows.Length == 0 || rows[0].Length != pagingInfo.DataColumns.Count)
            {
                throw new ArgumentException("Invalid result rows");
            }
            List <PreviewItem> list = new List <PreviewItem>(rows.Length);
            StoreId            sentItemsFolderId = null;

            if (!mailboxSession.IsPublicFolderSession)
            {
                sentItemsFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.SentItems);
            }
            Uri owaMailboxItemLink = LinkUtils.GetOwaMailboxItemLink(delegate
            {
            }, mailboxInfo, true);

            for (int i = 0; i < rows.Length; i++)
            {
                object[] array = rows[i];
                Dictionary <PropertyDefinition, object> properties = new Dictionary <PropertyDefinition, object>(4);
                int num = 0;
                foreach (PropertyDefinition key in pagingInfo.DataColumns)
                {
                    properties.Add(key, array[num]);
                    num++;
                }
                ReferenceItem sortValue = null;
                if (!usingSearchFolders)
                {
                    sortValue = new ReferenceItem(pagingInfo.SortBy, properties[pagingInfo.SortColumn], messageIdPairs.Find((KeyValuePair <int, long> x) => x.Key == (int)properties[ItemSchema.DocumentId]).Value);
                }
                else
                {
                    sortValue = new ReferenceItem(pagingInfo.SortBy, properties[pagingInfo.SortColumn], (long)mailboxSession.MailboxGuid.GetHashCode() << 32 | (long)((ulong)((int)properties[ItemSchema.DocumentId])));
                }
                List <PropertyDefinition> list2 = null;
                if (pagingInfo.AdditionalProperties != null && pagingInfo.AdditionalProperties.Count > 0)
                {
                    list2 = new List <PropertyDefinition>(pagingInfo.AdditionalProperties.Count);
                    foreach (ExtendedPropertyInfo extendedPropertyInfo in pagingInfo.AdditionalProperties)
                    {
                        list2.Add(extendedPropertyInfo.XsoPropertyDefinition);
                    }
                }
                PreviewItem item = new PreviewItem(properties, mailboxInfo.MailboxGuid, owaMailboxItemLink, sortValue, Util.CalculateUniqueItemHash(mailboxSession, array, pagingInfo, sentItemsFolderId), list2)
                {
                    MailboxInfo = mailboxInfo
                };
                list.Add(item);
            }
            PreviewItem[] array2 = list.ToArray();
            if (pagingInfo.ExcludeDuplicates)
            {
                array2 = Util.ExcludeDuplicateItems(array2);
            }
            return(array2);
        }
Exemplo n.º 5
0
 internal static PreviewItem[] CreateSearchPreviewItems(MailboxInfo mailboxInfo, object[][] rows, List <KeyValuePair <int, long> > messageIdPairs, StoreSession mailboxSession, PagingInfo pagingInfo)
 {
     Util.ThrowOnNull(rows, "rows");
     return(Util.InternalCreateSearchPreviewItems(mailboxInfo, rows, pagingInfo, mailboxSession, messageIdPairs, false));
 }