예제 #1
0
        protected override GetFlowConversationResponse InternalExecute()
        {
            QueryFilter  flowConversationFilter = GetFlowConversation.GetFlowConversationFilter(this.folderId, base.MailboxIdentityMailboxSession);
            IdAndSession folderIdAndSession     = GetFlowConversation.GetFolderIdAndSession(this.folderId, base.MailboxIdentityMailboxSession, base.IdConverter);
            List <FlowConversationItem> list    = new List <FlowConversationItem>();

            new ConversationFactory(base.MailboxIdentityMailboxSession);
            using (Folder folder = Folder.Bind((MailboxSession)folderIdAndSession.Session, folderIdAndSession.Id))
            {
                using (QueryResult queryResult = folder.ItemQuery(ItemQueryType.None, flowConversationFilter, GetFlowConversation.SortByArray, GetFlowConversation.ItemQueryRequiredProperties))
                {
                    IStorePropertyBag[] propertyBags = queryResult.GetPropertyBags(10000);
                    foreach (IStorePropertyBag storePropertyBag in propertyBags)
                    {
                        if ((long)list.Count == this.requestedConversationCount)
                        {
                            break;
                        }
                        ParticipantSet participantSet;
                        string         text = this.GenerateParticipantsHash(storePropertyBag, out participantSet);
                        if (!this.allItemsData.ContainsKey(text))
                        {
                            FlowConversationItem flowConversationItem = new FlowConversationItem();
                            ExDateTime           valueOrDefault       = storePropertyBag.GetValueOrDefault <ExDateTime>(ItemSchema.ReceivedTime, ExDateTime.Now);
                            string       valueOrDefault2 = storePropertyBag.GetValueOrDefault <string>(ItemSchema.Preview, null);
                            string       valueOrDefault3 = storePropertyBag.GetValueOrDefault <string>(ItemSchema.Subject, null);
                            bool         valueOrDefault4 = storePropertyBag.GetValueOrDefault <bool>(MessageItemSchema.IsRead, true);
                            IParticipant valueOrDefault5 = storePropertyBag.GetValueOrDefault <IParticipant>(ItemSchema.From, null);
                            VersionedId  valueOrDefault6 = storePropertyBag.GetValueOrDefault <VersionedId>(ItemSchema.Id, null);
                            storePropertyBag.GetValueOrDefault <ConversationId>(ItemSchema.ConversationId, null);
                            List <IParticipant> list2 = new List <IParticipant>(participantSet.Count + 1);
                            participantSet.ExceptWith(new IParticipant[]
                            {
                                valueOrDefault5
                            });
                            list2.Add(valueOrDefault5);
                            list2.AddRange(participantSet);
                            flowConversationItem.FlowConversationId      = text;
                            flowConversationItem.LastItemId              = IdConverter.ConvertStoreItemIdToItemId(valueOrDefault6, folderIdAndSession.Session);
                            flowConversationItem.Participants            = ReplyToProperty.Render(list2).ToArray();
                            flowConversationItem.SenderPhotoEmailAddress = valueOrDefault5.SmtpEmailAddress;
                            flowConversationItem.Preview         = valueOrDefault2;
                            flowConversationItem.Subject         = valueOrDefault3;
                            flowConversationItem.TotalCount      = 1;
                            flowConversationItem.UnReadCount     = (valueOrDefault4 ? 0 : 1);
                            flowConversationItem.ReceivedTimeUtc = ExDateTimeConverter.ToSoapHeaderTimeZoneRelatedXsdDateTime(valueOrDefault);
                            this.allItemsData.Add(text, flowConversationItem);
                            list.Add(flowConversationItem);
                        }
                        else
                        {
                            if (!storePropertyBag.GetValueOrDefault <bool>(MessageItemSchema.IsRead, true))
                            {
                                this.allItemsData[text].UnReadCount++;
                            }
                            this.allItemsData[text].TotalCount++;
                        }
                    }
                }
            }
            return(new GetFlowConversationResponse
            {
                Conversations = list.ToArray()
            });
        }
        // Token: 0x060015BF RID: 5567 RVA: 0x0004DD44 File Offset: 0x0004BF44
        protected override FindFlowConversationItemResponse InternalExecute()
        {
            QueryFilter         flowConversationFilter = GetFlowConversation.GetFlowConversationFilter(this.folderId, base.MailboxIdentityMailboxSession);
            IdAndSession        folderIdAndSession     = GetFlowConversation.GetFolderIdAndSession(this.folderId, base.MailboxIdentityMailboxSession, base.IdConverter);
            SortBy              sortBy = new SortBy(ItemSchema.ReceivedTime, SortOrder.Descending);
            List <FlowItem>     list   = new List <FlowItem>();
            ConversationFactory conversationFactory = new ConversationFactory(base.MailboxIdentityMailboxSession);

            using (Folder folder = Folder.Bind((MailboxSession)folderIdAndSession.Session, folderIdAndSession.Id))
            {
                using (QueryResult queryResult = folder.ItemQuery(ItemQueryType.None, flowConversationFilter, new SortBy[]
                {
                    sortBy
                }, FindFlowConversationItem.requiredProperties))
                {
                    IStorePropertyBag[] propertyBags = queryResult.GetPropertyBags(10000);
                    foreach (IStorePropertyBag storePropertyBag in propertyBags)
                    {
                        if ((long)list.Count == this.requestedItemCount)
                        {
                            break;
                        }
                        string text = this.GenerateParticipantsHash(storePropertyBag);
                        if (text.Equals(this.flowConversationId))
                        {
                            FlowItem       flowItem        = new FlowItem();
                            ExDateTime     valueOrDefault  = storePropertyBag.GetValueOrDefault <ExDateTime>(ItemSchema.ReceivedTime, ExDateTime.Now);
                            bool           valueOrDefault2 = storePropertyBag.GetValueOrDefault <bool>(MessageItemSchema.IsRead, true);
                            IParticipant   valueOrDefault3 = storePropertyBag.GetValueOrDefault <IParticipant>(ItemSchema.From, null);
                            VersionedId    valueOrDefault4 = storePropertyBag.GetValueOrDefault <VersionedId>(ItemSchema.Id, null);
                            ConversationId valueOrDefault5 = storePropertyBag.GetValueOrDefault <ConversationId>(ItemSchema.ConversationId, null);
                            flowItem.ItemId          = IdConverter.ConvertStoreItemIdToItemId(valueOrDefault4, base.MailboxIdentityMailboxSession);
                            flowItem.Sender          = FindFlowConversationItem.ConvertParticipantToEmailAddressWrapper(valueOrDefault3);
                            flowItem.IsRead          = valueOrDefault2;
                            flowItem.ReceivedTimeUtc = ExDateTimeConverter.ToSoapHeaderTimeZoneRelatedXsdDateTime(valueOrDefault);
                            Conversation key = conversationFactory.CreateConversation(valueOrDefault5, FindFlowConversationItem.ConversationCreatorRelevantProperties);
                            if (!this.conversationMap.ContainsKey(key))
                            {
                                this.conversationMap[key] = new List <StoreObjectId>();
                            }
                            this.conversationMap[key].Add(valueOrDefault4.ObjectId);
                            this.flowItemsMap[valueOrDefault4.ObjectId] = flowItem;
                            list.Add(flowItem);
                        }
                    }
                }
            }
            foreach (KeyValuePair <Conversation, List <StoreObjectId> > keyValuePair in this.conversationMap)
            {
                Conversation         key2  = keyValuePair.Key;
                List <StoreObjectId> value = keyValuePair.Value;
                key2.LoadItemParts(value);
                foreach (StoreObjectId storeObjectId in value)
                {
                    ItemPart itemPart = key2.GetItemPart(storeObjectId);
                    this.flowItemsMap[storeObjectId].ItemBody = itemPart.BodyPart;
                }
            }
            return(new FindFlowConversationItemResponse
            {
                Items = list.ToArray()
            });
        }