예제 #1
0
        internal void UpdateParentMsgRichContentFlags(RichContentFlags richContentFlags)
        {
            this.CheckDisposed(null);
            if (this.parentCollection == null || this.parentCollection.ContainerItem == null)
            {
                return;
            }
            ICoreItem        containerItem   = this.parentCollection.ContainerItem;
            ICorePropertyBag corePropertyBag = containerItem.PropertyBag;

            corePropertyBag.Load(new PropertyDefinition[]
            {
                InternalSchema.RichContent
            });
            short valueOrDefault = corePropertyBag.GetValueOrDefault <short>(InternalSchema.RichContent, 0);
            short num            = valueOrDefault | (short)richContentFlags;

            corePropertyBag[InternalSchema.RichContent] = num;
        }
예제 #2
0
        private static StoreObjectType?TryDetectFolderTreeDataStoreObjectType(ICorePropertyBag propertyBag, string itemClass, StoreObjectType detectedType)
        {
            StoreObjectType?result = null;

            if (ObjectClass.IsFolderTreeData(itemClass))
            {
                propertyBag.Load(new StorePropertyDefinition[]
                {
                    FolderTreeDataSchema.GroupSection,
                    FolderTreeDataSchema.Type
                });
                FolderTreeDataSection?valueAsNullable  = propertyBag.GetValueAsNullable <FolderTreeDataSection>(FolderTreeDataSchema.GroupSection);
                FolderTreeDataType?   valueAsNullable2 = propertyBag.GetValueAsNullable <FolderTreeDataType>(FolderTreeDataSchema.Type);
                if (valueAsNullable == FolderTreeDataSection.Calendar)
                {
                    if (valueAsNullable2 == FolderTreeDataType.Header)
                    {
                        result = new StoreObjectType?(StoreObjectType.CalendarGroup);
                    }
                    else if (valueAsNullable2 == FolderTreeDataType.NormalFolder || valueAsNullable2 == FolderTreeDataType.SharedFolder)
                    {
                        result = new StoreObjectType?(StoreObjectType.CalendarGroupEntry);
                    }
                }
                else if (valueAsNullable == FolderTreeDataSection.First)
                {
                    result = new StoreObjectType?(StoreObjectType.FavoriteFolderEntry);
                }
                else if (valueAsNullable == FolderTreeDataSection.Tasks)
                {
                    if (valueAsNullable2 == FolderTreeDataType.Header)
                    {
                        result = new StoreObjectType?(StoreObjectType.TaskGroup);
                    }
                    else if (valueAsNullable2 == FolderTreeDataType.NormalFolder)
                    {
                        result = new StoreObjectType?(StoreObjectType.TaskGroupEntry);
                    }
                }
            }
            return(result);
        }
예제 #3
0
        private static bool FixupMeetingMessage(IXSOFactory xsoFactory, IMailboxSession session, AggregationByItemClassReferencesSubjectProcessor.PropertyDefinitionListConstructorDelegate propertyDefinitionListConstructorDelegate, ICorePropertyBag corePropertyBag, ref ConversationIndex newIndex, ref ConversationIndex.FixupStage stage, out IStorePropertyBag parentItemPropertyBag)
        {
            corePropertyBag.Load(propertyDefinitionListConstructorDelegate(new PropertyDefinition[]
            {
                CalendarItemBaseSchema.GlobalObjectId,
                CalendarItemBaseSchema.CleanGlobalObjectId,
                CalendarItemBaseSchema.OwnerCriticalChangeTime,
                InternalSchema.AppointmentSequenceNumber
            }));
            byte[] array = corePropertyBag.TryGetProperty(CalendarItemBaseSchema.GlobalObjectId) as byte[];
            if (array == null)
            {
                parentItemPropertyBag = null;
                return(false);
            }
            GlobalObjectId globalObjectId;
            GlobalObjectId globalObjectId3;

            try
            {
                globalObjectId  = new GlobalObjectId(array);
                globalObjectId3 = new GlobalObjectId(array);
            }
            catch (CorruptDataException)
            {
                parentItemPropertyBag = null;
                return(false);
            }
            globalObjectId3.Date = ExDateTime.MinValue;
            string     valueOrDefault          = corePropertyBag.GetValueOrDefault <string>(InternalSchema.ItemClass, string.Empty);
            bool       isRequest               = ObjectClass.IsMeetingRequest(valueOrDefault);
            object     fixupStage              = null;
            ExDateTime ownerCriticalChangeTime = corePropertyBag.GetValueOrDefault <ExDateTime>(CalendarItemBaseSchema.OwnerCriticalChangeTime, ExDateTime.MaxValue);
            int        sequenceNumber          = corePropertyBag.GetValueOrDefault <int>(InternalSchema.AppointmentSequenceNumber, -1);

            if (sequenceNumber == -1)
            {
                parentItemPropertyBag = null;
                return(false);
            }
            parentItemPropertyBag = xsoFactory.RunQueryOnAllItemsFolder <IStorePropertyBag>(session, AllItemsFolderHelper.SupportedSortBy.CleanGlobalObjectId, globalObjectId3.Bytes, null, delegate(QueryResult queryResult)
            {
                IStorePropertyBag result = null;
                bool flag2 = false;
                while (!flag2)
                {
                    IStorePropertyBag[] propertyBags = queryResult.GetPropertyBags(50);
                    flag2 = (propertyBags.Length == 0);
                    IStorePropertyBag[] array2 = propertyBags;
                    int i = 0;
                    while (i < array2.Length)
                    {
                        IStorePropertyBag storePropertyBag = array2[i];
                        VersionedId versionedId            = (VersionedId)storePropertyBag.TryGetProperty(ItemSchema.Id);
                        byte[] array3 = (storePropertyBag.TryGetProperty(CalendarItemBaseSchema.GlobalObjectId) as byte[]) ?? (storePropertyBag.TryGetProperty(CalendarItemBaseSchema.CleanGlobalObjectId) as byte[]);
                        if (array3 != null && GlobalObjectId.CompareCleanGlobalObjectIds(array3, globalObjectId.Bytes))
                        {
                            GlobalObjectId globalObjectId2 = new GlobalObjectId(array3);
                            if (versionedId.ObjectId.ObjectType == StoreObjectType.MeetingRequest)
                            {
                                ConversationId conversationId = storePropertyBag.TryGetProperty(ConversationItemSchema.ConversationId) as ConversationId;
                                if (conversationId != null)
                                {
                                    if (isRequest)
                                    {
                                        fixupStage = ConversationIndex.FixupStage.M1;
                                        return(storePropertyBag);
                                    }
                                    if (AggregationByItemClassReferencesSubjectProcessor.IsMatchForMeetingResponse(globalObjectId, ownerCriticalChangeTime, sequenceNumber, storePropertyBag))
                                    {
                                        if (globalObjectId.Date != ExDateTime.MinValue && globalObjectId.Date == globalObjectId2.Date)
                                        {
                                            fixupStage = ConversationIndex.FixupStage.M3;
                                            return(storePropertyBag);
                                        }
                                        if (globalObjectId.Date == ExDateTime.MinValue)
                                        {
                                            fixupStage = ConversationIndex.FixupStage.M2;
                                            return(storePropertyBag);
                                        }
                                        fixupStage = ConversationIndex.FixupStage.M4;
                                        result     = storePropertyBag;
                                    }
                                }
                            }
                            i++;
                            continue;
                        }
                        return(result);
                    }
                }
                return(result);
            }, propertyDefinitionListConstructorDelegate(new PropertyDefinition[]
            {
                CalendarItemBaseSchema.GlobalObjectId,
                CalendarItemBaseSchema.CleanGlobalObjectId,
                InternalSchema.AppointmentSequenceNumber,
                CalendarItemBaseSchema.OwnerCriticalChangeTime,
                ConversationItemSchema.ConversationId
            }));
            if (parentItemPropertyBag == null)
            {
                return(false);
            }
            ConversationIndex conversationIndex;

            if (!ConversationIndex.TryCreate(parentItemPropertyBag.TryGetProperty(ItemSchema.ConversationIndex) as byte[], out conversationIndex))
            {
                return(false);
            }
            bool?flag = parentItemPropertyBag.TryGetProperty(ItemSchema.ConversationIndexTracking) as bool?;

            stage = ((flag == null || !flag.Value) ? ConversationIndex.FixupStage.L1 : ((ConversationIndex.FixupStage)fixupStage));
            if (isRequest)
            {
                byte[]            valueOrDefault2 = corePropertyBag.GetValueOrDefault <byte[]>(ItemSchema.ConversationIndex);
                ConversationIndex conversationIndex2;
                if (valueOrDefault2 != null && ConversationIndex.TryCreate(valueOrDefault2, out conversationIndex2))
                {
                    newIndex = conversationIndex.UpdateHeader(conversationIndex2.Components[0]);
                }
                else
                {
                    newIndex = ConversationIndex.Create(conversationIndex.Guid);
                }
            }
            else
            {
                newIndex = ConversationIndex.CreateFromParent(conversationIndex.Bytes);
            }
            return(true);
        }