예제 #1
0
        // Token: 0x06000F5C RID: 3932 RVA: 0x0003B790 File Offset: 0x00039990
        private static ConversationType GetConversationFromDataRow(OwaSearchContext searchContext, MailboxSession mailboxSession, object[] row, Dictionary <PropertyDefinition, int> orderDictionary)
        {
            ConversationType conversationType = new ConversationType();

            conversationType.InstanceKey = SearchFolderDataRetrieverBase.GetItemProperty <byte[]>(row, orderDictionary[ItemSchema.InstanceKey], null);
            ConversationId itemProperty = SearchFolderDataRetrieverBase.GetItemProperty <ConversationId>(row, orderDictionary[ConversationItemSchema.ConversationId], null);

            conversationType.ConversationId    = new ItemId(IdConverter.ConversationIdToEwsId(mailboxSession.MailboxGuid, itemProperty), null);
            conversationType.ConversationTopic = SearchFolderDataRetrieverBase.GetItemProperty <string>(row, orderDictionary[ConversationItemSchema.ConversationTopic]);
            conversationType.UniqueRecipients  = SearchFolderDataRetrieverBase.GetItemProperty <string[]>(row, orderDictionary[ConversationItemSchema.ConversationMVTo]);
            conversationType.UniqueSenders     = SearchFolderDataRetrieverBase.GetItemProperty <string[]>(row, orderDictionary[ConversationItemSchema.ConversationMVFrom]);
            conversationType.LastDeliveryTime  = SearchFolderDataRetrieverBase.GetDateTimeProperty(searchContext.RequestTimeZone, row, orderDictionary[ConversationItemSchema.ConversationLastDeliveryTime]);
            conversationType.Categories        = SearchFolderDataRetrieverBase.GetItemProperty <string[]>(row, orderDictionary[ConversationItemSchema.ConversationCategories]);
            if (SearchFolderDataRetrieverBase.IsPropertyDefined(row, orderDictionary[ConversationItemSchema.ConversationFlagStatus]))
            {
                FlagStatus itemProperty2 = (FlagStatus)SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationFlagStatus], 0);
                if (itemProperty2 != FlagStatus.NotFlagged)
                {
                    conversationType.FlagStatus = new FlagType
                    {
                        FlagStatus = itemProperty2
                    }.FlagStatus;
                }
            }
            conversationType.HasAttachments     = new bool?(SearchFolderDataRetrieverBase.GetItemProperty <bool>(row, orderDictionary[ConversationItemSchema.ConversationHasAttach]));
            conversationType.HasIrm             = new bool?(SearchFolderDataRetrieverBase.GetItemProperty <bool>(row, orderDictionary[ConversationItemSchema.ConversationHasIrm]));
            conversationType.MessageCount       = new int?(SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationMessageCount]));
            conversationType.GlobalMessageCount = new int?(SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationGlobalMessageCount]));
            conversationType.UnreadCount        = new int?(SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationUnreadMessageCount]));
            conversationType.GlobalUnreadCount  = new int?(SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationGlobalUnreadMessageCount]));
            conversationType.Size             = new int?(SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationMessageSize]));
            conversationType.ItemClasses      = SearchFolderDataRetrieverBase.GetItemProperty <string[]>(row, orderDictionary[ConversationItemSchema.ConversationMessageClasses]);
            conversationType.ImportanceString = ((ImportanceType)SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationImportance], 1)).ToString();
            StoreId[] itemProperty3 = SearchFolderDataRetrieverBase.GetItemProperty <StoreId[]>(row, orderDictionary[ConversationItemSchema.ConversationItemIds], new StoreId[0]);
            conversationType.ItemIds = Array.ConvertAll <StoreId, ItemId>(itemProperty3, (StoreId s) => new ItemId(SearchFolderDataRetrieverBase.GetEwsId(s, mailboxSession.MailboxGuid), null));
            StoreId[] itemProperty4 = SearchFolderDataRetrieverBase.GetItemProperty <StoreId[]>(row, orderDictionary[ConversationItemSchema.ConversationGlobalItemIds], new StoreId[0]);
            conversationType.GlobalItemIds    = Array.ConvertAll <StoreId, ItemId>(itemProperty4, (StoreId s) => new ItemId(SearchFolderDataRetrieverBase.GetEwsId(s, mailboxSession.MailboxGuid), null));
            conversationType.LastModifiedTime = SearchFolderDataRetrieverBase.GetDateTimeProperty(searchContext.RequestTimeZone, row, orderDictionary[StoreObjectSchema.LastModifiedTime]);
            conversationType.Preview          = SearchFolderDataRetrieverBase.GetItemProperty <string>(row, orderDictionary[ConversationItemSchema.ConversationPreview]);
            IconIndex itemProperty5 = (IconIndex)SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationReplyForwardState]);

            if (itemProperty5 > (IconIndex)0)
            {
                conversationType.IconIndexString = itemProperty5.ToString();
            }
            itemProperty5 = (IconIndex)SearchFolderDataRetrieverBase.GetItemProperty <int>(row, orderDictionary[ConversationItemSchema.ConversationGlobalReplyForwardState]);
            if (itemProperty5 > (IconIndex)0)
            {
                conversationType.GlobalIconIndexString = itemProperty5.ToString();
            }
            return(conversationType);
        }
        protected static string GetDateTimeProperty(ExTimeZone timeZone, object[] row, int index)
        {
            ExDateTime itemProperty = SearchFolderDataRetrieverBase.GetItemProperty <ExDateTime>(row, index, ExDateTime.MinValue);

            if (ExDateTime.MinValue.Equals(itemProperty))
            {
                return(null);
            }
            if (timeZone == null)
            {
                throw new ArgumentNullException("timeZone");
            }
            return(ExDateTimeConverter.ToOffsetXsdDateTime(itemProperty, timeZone));
        }
        protected static T GetItemProperty <T>(object[] row, int index, T defaultValue)
        {
            if (!SearchFolderDataRetrieverBase.IsPropertyDefined(row, index))
            {
                return(defaultValue);
            }
            object obj = row[index];

            if (!(obj is T))
            {
                return(defaultValue);
            }
            return((T)((object)obj));
        }
예제 #4
0
        // Token: 0x06000F60 RID: 3936 RVA: 0x0003BCB8 File Offset: 0x00039EB8
        private static ItemType GetItemFromDataRow(OwaSearchContext searchContext, MailboxSession mailboxSession, object[] row, Dictionary <PropertyDefinition, int> orderDictionary)
        {
            StoreId       itemProperty  = SearchFolderDataRetrieverBase.GetItemProperty <StoreId>(row, orderDictionary[ItemSchema.Id], null);
            StoreObjectId storeObjectId = StoreId.GetStoreObjectId(itemProperty);
            ItemType      itemType      = ItemType.CreateFromStoreObjectType(storeObjectId.ObjectType);

            itemType.ItemId = SearchFolderDataRetrieverBase.StoreIdToEwsItemId(itemProperty, new MailboxId(mailboxSession.MailboxGuid, false));
            byte[] itemProperty2 = SearchFolderDataRetrieverBase.GetItemProperty <byte[]>(row, orderDictionary[ItemSchema.InstanceKey], new byte[0]);
            itemType.InstanceKey       = itemProperty2;
            itemType.InstanceKeyString = Convert.ToBase64String(itemProperty2);
            itemType.ParentFolderId    = new FolderId(SearchFolderDataRetrieverBase.GetEwsId(SearchFolderDataRetrieverBase.GetItemProperty <StoreId>(row, orderDictionary[StoreObjectSchema.ParentItemId], null), mailboxSession.MailboxGuid), null);
            itemType.ConversationId    = new ItemId(IdConverter.ConversationIdToEwsId(mailboxSession.MailboxGuid, SearchFolderDataRetrieverBase.GetItemProperty <ConversationId>(row, orderDictionary[ItemSchema.ConversationId], null)), null);
            itemType.Subject           = SearchFolderDataRetrieverBase.GetItemProperty <string>(row, orderDictionary[ItemSchema.Subject], string.Empty);
            itemType.ImportanceString  = SearchFolderDataRetrieverBase.GetItemProperty <Importance>(row, orderDictionary[ItemSchema.Importance], Importance.Normal).ToString();
            itemType.SensitivityString = SearchFolderDataRetrieverBase.GetItemProperty <Sensitivity>(row, orderDictionary[ItemSchema.Sensitivity], Sensitivity.Normal).ToString();
            string dateTimeProperty = SearchFolderDataRetrieverBase.GetDateTimeProperty(searchContext.RequestTimeZone, row, orderDictionary[ItemSchema.ReceivedTime]);

            if (!string.IsNullOrEmpty(dateTimeProperty))
            {
                itemType.DateTimeReceived = dateTimeProperty;
            }
            string dateTimeProperty2 = SearchFolderDataRetrieverBase.GetDateTimeProperty(searchContext.RequestTimeZone, row, orderDictionary[ItemSchema.SentTime]);

            if (!string.IsNullOrEmpty(dateTimeProperty2))
            {
                itemType.DateTimeSent = dateTimeProperty2;
            }
            itemType.HasAttachments = new bool?(SearchFolderDataRetrieverBase.GetItemProperty <bool>(row, orderDictionary[ItemSchema.HasAttachment], false));
            itemType.IsDraft        = new bool?(SearchFolderDataRetrieverBase.GetItemProperty <bool>(row, orderDictionary[MessageItemSchema.IsDraft], false));
            itemType.ItemClass      = SearchFolderDataRetrieverBase.GetItemProperty <string>(row, orderDictionary[StoreObjectSchema.ItemClass], string.Empty);
            itemType.Preview        = SearchFolderDataRetrieverBase.GetItemProperty <string>(row, orderDictionary[ItemSchema.Preview], string.Empty);
            MessageType messageType = itemType as MessageType;

            if (messageType != null)
            {
                Participant itemProperty3 = SearchFolderDataRetrieverBase.GetItemProperty <Participant>(row, orderDictionary[ItemSchema.From], null);
                if (itemProperty3 != null)
                {
                    messageType.From = RowNotificationHandler.CreateRecipientFromParticipant(itemProperty3);
                }
                Participant itemProperty4 = SearchFolderDataRetrieverBase.GetItemProperty <Participant>(row, orderDictionary[ItemSchema.Sender], null);
                if (itemProperty4 != null)
                {
                    messageType.Sender = RowNotificationHandler.CreateRecipientFromParticipant(itemProperty4);
                }
                messageType.IsRead = new bool?(SearchFolderDataRetrieverBase.GetItemProperty <bool>(row, orderDictionary[MessageItemSchema.IsRead], false));
            }
            IconIndex itemProperty5 = SearchFolderDataRetrieverBase.GetItemProperty <IconIndex>(row, orderDictionary[ItemSchema.IconIndex], IconIndex.Default);

            if (itemProperty5 != IconIndex.Default)
            {
                itemType.IconIndexString = itemProperty5.ToString();
            }
            FlagType flagType = new FlagType();

            itemType.Flag             = flagType;
            flagType.FlagStatus       = SearchFolderDataRetrieverBase.GetItemProperty <FlagStatus>(row, orderDictionary[ItemSchema.FlagStatus], FlagStatus.NotFlagged);
            itemType.DateTimeCreated  = SearchFolderDataRetrieverBase.GetDateTimeProperty(searchContext.RequestTimeZone, row, orderDictionary[StoreObjectSchema.CreationTime]);
            itemType.LastModifiedTime = SearchFolderDataRetrieverBase.GetDateTimeProperty(searchContext.RequestTimeZone, row, orderDictionary[StoreObjectSchema.LastModifiedTime]);
            itemType.Size             = SearchFolderDataRetrieverBase.GetItemProperty <int?>(row, orderDictionary[ItemSchema.Size], null);
            itemType.DisplayTo        = SearchFolderDataRetrieverBase.GetItemProperty <string>(row, orderDictionary[ItemSchema.DisplayTo], null);
            itemType.Categories       = SearchFolderDataRetrieverBase.GetItemProperty <string[]>(row, orderDictionary[ItemSchema.Categories], null);
            return(itemType);
        }
 protected static T GetItemProperty <T>(object[] row, int index)
 {
     return(SearchFolderDataRetrieverBase.GetItemProperty <T>(row, index, default(T)));
 }