internal static ConversationActionItem Create(MailboxSession session, ConversationId conversationId, string conversationTopic)
 {
     Util.ThrowOnNullArgument(session, "session");
     Util.ThrowOnNullArgument(conversationId, "conversationId");
     Util.ThrowOnNullArgument(conversationTopic, "conversationTopic");
     return(ConversationActionItem.InternalCreate(session, conversationId, conversationTopic));
 }
예제 #2
0
        public List <IConversationTreeNode> GetInFolderItemsForConversation(ConversationId conversationId)
        {
            this.CheckDisposed("GetInFolderItemsForConversation");
            if (conversationId == null)
            {
                return(null);
            }
            List <IConversationTreeNode> list = null;
            Conversation conversation         = Conversation.Load((MailboxSession)this.folder.Session, conversationId, MailboxSyncProvider.conversationPrefetchProperties);

            if (conversation == null)
            {
                return(list);
            }
            list = new List <IConversationTreeNode>(conversation.ConversationTree.Count);
            StoreObjectId objectId = this.folder.Id.ObjectId;

            foreach (IConversationTreeNode conversationTreeNode in conversation.ConversationTree)
            {
                StoreObjectId id = (StoreObjectId)conversationTreeNode.StorePropertyBags[0].TryGetProperty(StoreObjectSchema.ParentItemId);
                if (objectId.Equals(id))
                {
                    list.Add(conversationTreeNode);
                }
            }
            return(list);
        }
        private static ConversationIndex GetConversationIndex(ConversationId conversationId)
        {
            ConversationIndex conversationIndex = ConversationIndex.Create(conversationId);

            byte[] header = new byte[5];
            return(conversationIndex.UpdateHeader(header));
        }
        protected sealed override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            ConversationId conversationId = value as ConversationId;

            if (conversationId == null)
            {
                throw new ArgumentException("value", "Must be a non-null ConversationId instance");
            }
            ConversationIndex conversationIndex;

            if (!ConversationIndex.TryCreate(propertyBag.GetValueOrDefault <byte[]>(InternalSchema.ConversationIndex), out conversationIndex))
            {
                conversationIndex = ConversationIndex.Create(conversationId);
            }
            else
            {
                conversationIndex = conversationIndex.UpdateGuid(new Guid(conversationId.GetBytes()));
            }
            byte[] array          = conversationIndex.ToByteArray();
            string valueOrDefault = propertyBag.GetValueOrDefault <string>(InternalSchema.ItemClass);

            if (valueOrDefault != null && ObjectClass.IsOfClass(valueOrDefault, "IPM.ConversationAction"))
            {
                array[0] = 1;
                array[1] = (array[2] = (array[3] = (array[4] = (array[5] = 0))));
            }
            propertyBag.SetValueWithFixup(InternalSchema.ConversationIndex, array);
        }
예제 #5
0
 public void LogAggregationResultData(ConversationAggregationResult aggregationResult)
 {
     this.LogEvent(new SchemaBasedLogEvent <ConversationAggregationLogSchema.AggregationResult>
     {
         {
             ConversationAggregationLogSchema.AggregationResult.ConversationFamilyId,
             aggregationResult.ConversationFamilyId
         },
         {
             ConversationAggregationLogSchema.AggregationResult.ConversationId,
             ConversationId.Create(aggregationResult.ConversationIndex)
         },
         {
             ConversationAggregationLogSchema.AggregationResult.IsOutOfOrderDelivery,
             ConversationIndex.IsFixupAddingOutOfOrderMessageToConversation(aggregationResult.Stage)
         },
         {
             ConversationAggregationLogSchema.AggregationResult.NewConversationCreated,
             ConversationIndex.IsFixUpCreatingNewConversation(aggregationResult.Stage)
         },
         {
             ConversationAggregationLogSchema.AggregationResult.SupportsSideConversation,
             aggregationResult.SupportsSideConversation
         },
         {
             ConversationAggregationLogSchema.AggregationResult.FixupStage,
             aggregationResult.Stage
         }
     });
 }
예제 #6
0
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            object value = propertyBag.GetValue(this.conversationIdPropertyDefinition);

            byte[] array = value as byte[];
            if (array != null)
            {
                object result;
                try
                {
                    result = ConversationId.Create(array);
                }
                catch (CorruptDataException)
                {
                    result = new PropertyError(this, PropertyErrorCode.CorruptedData);
                }
                return(result);
            }
            PropertyError propertyError = (PropertyError)value;

            if (propertyError.PropertyErrorCode == PropertyErrorCode.NotEnoughMemory)
            {
                return(new PropertyError(this, PropertyErrorCode.CorruptedData));
            }
            return(new PropertyError(this, propertyError.PropertyErrorCode));
        }
예제 #7
0
 internal Conversation(ConversationId conversationId, IConversationTree conversationTree, MailboxSession session, ConversationDataExtractor conversationDataExtractor, IConversationTreeFactory conversationTreeFactory, ConversationStateFactory stateFactory)
 {
     this.conversationId            = conversationId;
     this.conversationTree          = conversationTree;
     this.session                   = session;
     this.conversationDataExtractor = conversationDataExtractor;
     this.conversationTreeFactory   = conversationTreeFactory;
     this.stateFactory              = stateFactory;
 }
        public static StoreId QueryConversationActionsFolder(MailboxSession session, ConversationId conversationId)
        {
            IList <StoreId> list = ConversationActionItem.QueryConversationActionsFolder(session, conversationId, 1);

            if (list == null)
            {
                return(null);
            }
            return(list[0]);
        }
예제 #9
0
        protected sealed override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            if (value == null)
            {
                propertyBag.Delete(InternalSchema.MapiConversationFamilyId);
                return;
            }
            ConversationId conversationId = value as ConversationId;

            if (conversationId == null)
            {
                throw new ArgumentException("value", "Must be null or ConversationId");
            }
            propertyBag.SetOrDeleteProperty(InternalSchema.MapiConversationFamilyId, conversationId.GetBytes());
        }
        internal static QueryFilter ConversationIdBasedSmartFilterToNativeFilter(this SmartPropertyDefinition conversationIdSmartPropertyDefinition, SinglePropertyFilter filter, PropertyDefinition conversationIdNativePropertyDefinition)
        {
            ComparisonFilter comparisonFilter = filter as ComparisonFilter;

            if (comparisonFilter != null)
            {
                ConversationId conversationId = (ConversationId)comparisonFilter.PropertyValue;
                return(new ComparisonFilter(comparisonFilter.ComparisonOperator, conversationIdNativePropertyDefinition, conversationId.GetBytes()));
            }
            ExistsFilter existsFilter = filter as ExistsFilter;

            if (existsFilter != null)
            {
                return(new ExistsFilter(conversationIdNativePropertyDefinition));
            }
            throw conversationIdSmartPropertyDefinition.CreateInvalidFilterConversionException(filter);
        }
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            byte[] valueOrDefault  = propertyBag.GetValueOrDefault <byte[]>(InternalSchema.MapiConversationFamilyId, null);
            byte[] valueOrDefault2 = propertyBag.GetValueOrDefault <byte[]>(InternalSchema.ConversationIndex);
            if (valueOrDefault2 == null || valueOrDefault == null)
            {
                return(null);
            }
            ConversationIndex conversationIndex;
            bool           flag           = ConversationIndex.TryCreate(valueOrDefault2, out conversationIndex);
            ConversationId conversationId = ConversationId.Create(valueOrDefault);

            if (!flag)
            {
                return(null);
            }
            return(conversationIndex.UpdateGuid(conversationId).ToByteArray());
        }
        private static ConversationActionItem InternalCreate(MailboxSession session, ConversationId conversationId, string conversationTopic)
        {
            StoreId conversationActionsFolderId = ConversationActionItem.GetConversationActionsFolderId(session, true);

            if (conversationActionsFolderId == null)
            {
                throw new NotSupportedException("Failed to get conversation actions folder");
            }
            ConversationActionItem conversationActionItem = ItemBuilder.CreateNewItem <ConversationActionItem>(session, conversationActionsFolderId, ItemCreateInfo.ConversationActionInfo, CreateMessageType.Associated);

            conversationActionItem[ItemSchema.ConversationTopic] = conversationTopic;
            conversationActionItem[ItemSchema.Subject]           = conversationTopic;
            conversationActionItem[StoreObjectSchema.ItemClass]  = "IPM.ConversationAction";
            conversationActionItem[ItemSchema.ConversationId]    = conversationId;
            conversationActionItem.SetExpiration();
            conversationActionItem[ConversationActionItemSchema.ConversationActionVersion] = ConversationActionItem.MakeVersion();
            return(conversationActionItem);
        }
예제 #13
0
            protected override bool TryAggregate(PropertyAggregationContext context, out object value)
            {
                ConversationId conversationId = null;

                foreach (IStorePropertyBag storePropertyBag in context.Sources)
                {
                    ConversationId valueOrDefault = storePropertyBag.GetValueOrDefault <ConversationId>(InternalSchema.ConversationId, null);
                    if (conversationId != null && valueOrDefault != null && !valueOrDefault.Equals(conversationId))
                    {
                        throw new ArgumentException("sources", "Property bag collection should have same conversationId");
                    }
                    if (conversationId == null)
                    {
                        conversationId = valueOrDefault;
                    }
                }
                value = conversationId;
                return(true);
            }
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            propertyBag.GetValueOrDefault <string>(InternalSchema.ItemClass);
            byte[] valueOrDefault = propertyBag.GetValueOrDefault <byte[]>(InternalSchema.ConversationIndex);
            if (valueOrDefault == null)
            {
                return(null);
            }
            ConversationIndex conversationIndex;

            if (!ConversationIndex.TryCreate(valueOrDefault, out conversationIndex))
            {
                return(null);
            }
            bool?valueAsNullable = propertyBag.GetValueAsNullable <bool>(InternalSchema.ConversationIndexTracking);

            if (valueAsNullable == null || !valueAsNullable.Value)
            {
                string topic = propertyBag.GetValueOrDefault <string>(InternalSchema.ConversationTopic) ?? string.Empty;
                byte[] bytes = this.ComputeHashTopic(topic);
                return(ConversationId.Create(bytes));
            }
            return(ConversationId.Create(conversationIndex.Guid));
        }
예제 #15
0
 public OptimizationInfo(ConversationId conversationId, int totalNodeCount)
 {
     this.ConversationId = conversationId;
     this.TotalNodeCount = totalNodeCount;
 }
예제 #16
0
 internal static Conversation Load(MailboxSession session, ConversationId conversationId, IList <StoreObjectId> foldersToIgnore, bool isIrmEnabled, params PropertyDefinition[] propertyDefinitions)
 {
     return(Conversation.Load(session, conversationId, foldersToIgnore, true, isIrmEnabled, propertyDefinitions));
 }
예제 #17
0
        protected virtual void UpdateNewItemProperties()
        {
            IExchangePrincipal exchangePrincipal = (this.newItem.Session == null) ? null : this.newItem.Session.MailboxOwner;
            MailboxSession     mailboxSession    = this.newItem.Session as MailboxSession;

            if (mailboxSession != null && exchangePrincipal != null)
            {
                PostItem postItem = this.newItem as PostItem;
                if (postItem != null)
                {
                    postItem.Sender = new Participant(exchangePrincipal);
                }
                else
                {
                    ((MessageItem)this.newItem).Sender = new Participant(exchangePrincipal);
                }
            }
            string text           = null;
            string valueOrDefault = this.originalItem.GetValueOrDefault <string>(InternalSchema.InternetMessageId);

            if (!string.IsNullOrEmpty(valueOrDefault))
            {
                text = valueOrDefault;
            }
            string text2 = null;

            valueOrDefault = this.originalItem.GetValueOrDefault <string>(InternalSchema.InReplyTo);
            if (!string.IsNullOrEmpty(valueOrDefault))
            {
                text2 = valueOrDefault;
            }
            this.newItem.SafeSetProperty(InternalSchema.InReplyTo, text);
            StringBuilder stringBuilder = new StringBuilder(128);

            valueOrDefault = this.originalItem.GetValueOrDefault <string>(InternalSchema.InternetReferences);
            if (!string.IsNullOrEmpty(valueOrDefault))
            {
                stringBuilder.Append(valueOrDefault);
            }
            else if (text2 != null)
            {
                stringBuilder.Append(text2);
            }
            if (text != null)
            {
                if (stringBuilder.Length + 1 + text.Length > 32768 || stringBuilder.Length == 0)
                {
                    stringBuilder.Clear();
                    stringBuilder.Append(text);
                }
                else
                {
                    stringBuilder.Append(',');
                    stringBuilder.Append(text);
                }
            }
            this.newItem.SafeSetProperty(InternalSchema.InternetReferences, stringBuilder.ToString());
            this.newItem.SafeSetProperty(InternalSchema.Categories, StoreObject.SafePropertyValue(this.originalItem.TryGetProperty(InternalSchema.Categories), typeof(string[]), null));
            byte[]            parentBytes       = this.originalItem.TryGetProperty(InternalSchema.ConversationIndex) as byte[];
            ConversationIndex conversationIndex = ConversationIndex.CreateFromParent(parentBytes);

            this.newItem.SafeSetProperty(InternalSchema.ConversationIndex, conversationIndex.ToByteArray());
            ConversationId valueOrDefault2 = this.originalItem.GetValueOrDefault <ConversationId>(InternalSchema.ConversationFamilyId);

            this.newItem.SafeSetProperty(InternalSchema.ConversationFamilyId, valueOrDefault2);
            object propValue = this.originalItem.TryGetProperty(InternalSchema.SupportsSideConversation);

            this.newItem.SafeSetProperty(InternalSchema.SupportsSideConversation, propValue);
            ConversationCreatorSidCalculatorFactory conversationCreatorSidCalculatorFactory = new ConversationCreatorSidCalculatorFactory(XSOFactory.Default);
            IConversationCreatorSidCalculator       conversationCreatorSidCalculator;

            byte[] propValue2;
            if (conversationCreatorSidCalculatorFactory.TryCreate(mailboxSession, exchangePrincipal, out conversationCreatorSidCalculator) && conversationCreatorSidCalculator.TryCalculateOnReply(conversationIndex, out propValue2))
            {
                this.newItem.SafeSetProperty(ItemSchema.ConversationCreatorSID, propValue2);
            }
            bool?valueAsNullable = this.originalItem.GetValueAsNullable <bool>(InternalSchema.ConversationIndexTracking);

            if (valueAsNullable != null && valueAsNullable.Value)
            {
                this.newItem.SafeSetProperty(InternalSchema.ConversationIndexTracking, true);
            }
            this.newItem.SafeSetProperty(InternalSchema.ConversationTopic, StoreObject.SafePropertyValue(this.originalItem.TryGetProperty(InternalSchema.ConversationTopic), typeof(string), StoreObject.SafePropertyValue(this.originalItem.TryGetProperty(InternalSchema.NormalizedSubjectInternal), typeof(string), null)));
            this.newItem.SafeSetProperty(InternalSchema.Sensitivity, StoreObject.SafePropertyValue(this.originalItem.TryGetProperty(InternalSchema.Sensitivity), typeof(Sensitivity), Sensitivity.Normal));
            this.newItem.SafeSetProperty(InternalSchema.OriginalSensitivity, StoreObject.SafePropertyValue(this.originalItem.TryGetProperty(InternalSchema.OriginalSensitivity), typeof(Sensitivity), Sensitivity.Normal));
            this.newItem.SafeSetProperty(InternalSchema.IsReadReceiptRequested, false);
            this.newItem.SafeSetProperty(InternalSchema.IsDeliveryReceiptRequested, false);
            this.newItem.SafeSetProperty(InternalSchema.IsReplyRequested, StoreObject.SafePropertyValue(this.originalItem.TryGetProperty(InternalSchema.IsReplyRequested), typeof(bool), null));
            this.newItem.SafeSetProperty(InternalSchema.IsResponseRequested, StoreObject.SafePropertyValue(this.originalItem.TryGetProperty(InternalSchema.IsResponseRequested), typeof(bool), null));
            this.newItem.SafeSetProperty(InternalSchema.NativeBlockStatus, StoreObject.SafePropertyValue(this.originalItem.TryGetProperty(InternalSchema.NativeBlockStatus), typeof(int), null));
            object obj = this.originalItem.TryGetProperty(InternalSchema.IconIndex);

            if (!PropertyError.IsPropertyError(obj))
            {
                IconIndex iconIndex = (IconIndex)obj;
                if (iconIndex != IconIndex.Default)
                {
                    iconIndex = ReplyForwardCommon.GetIconIndexForNewItem(iconIndex);
                    this.newItem.SafeSetProperty(InternalSchema.IconIndex, iconIndex);
                }
            }
            ReplyForwardCommon.UpdateXLoop(this.originalItem, this.newItem, this.parameters.XLoop);
        }
        public static IList <StoreId> QueryConversationActionsFolder(MailboxSession session, ConversationId conversationId, int maxRowCount, out int totalActionItemCount)
        {
            totalActionItemCount = 0;
            StoreId conversationActionsFolderId = ConversationActionItem.GetConversationActionsFolderId(session, false);

            if (conversationActionsFolderId == null)
            {
                return(null);
            }
            IList <StoreId> result;

            try
            {
                using (Folder folder = Folder.Bind(session, conversationActionsFolderId))
                {
                    int?valueAsNullable = folder.GetValueAsNullable <int>(FolderSchema.AssociatedItemCount);
                    if (valueAsNullable != null && valueAsNullable <= 0)
                    {
                        result = null;
                    }
                    else
                    {
                        totalActionItemCount = ((valueAsNullable != null) ? valueAsNullable.Value : 0);
                        if (conversationId == null)
                        {
                            result = null;
                        }
                        else
                        {
                            SortBy[] sortColumns = new SortBy[]
                            {
                                new SortBy(ItemSchema.ConversationIndex, SortOrder.Ascending),
                                new SortBy(StoreObjectSchema.LastModifiedTime, SortOrder.Descending)
                            };
                            ConversationIndex conversationIndex = ConversationActionItem.GetConversationIndex(conversationId);
                            using (QueryResult queryResult = folder.ItemQuery(ItemQueryType.Associated, null, sortColumns, new PropertyDefinition[]
                            {
                                ItemSchema.ConversationIndex,
                                ItemSchema.Id,
                                ConversationActionItemSchema.ConversationActionVersion
                            }))
                            {
                                if (queryResult.SeekToCondition(SeekReference.OriginBeginning, new ComparisonFilter(ComparisonOperator.Equal, ItemSchema.ConversationIndex, conversationIndex.ToByteArray())))
                                {
                                    IStorePropertyBag[] propertyBags = queryResult.GetPropertyBags(maxRowCount);
                                    if (propertyBags.Length >= 1)
                                    {
                                        List <StoreId> list = new List <StoreId>();
                                        for (int i = 0; i < propertyBags.Length; i++)
                                        {
                                            byte[] array = propertyBags[i][ItemSchema.ConversationIndex] as byte[];
                                            if (array != null)
                                            {
                                                ConversationIndex conversationIndex2;
                                                bool flag = ConversationIndex.TryCreate(array, out conversationIndex2);
                                                if (flag)
                                                {
                                                    if (!conversationIndex2.Equals(conversationIndex))
                                                    {
                                                        break;
                                                    }
                                                    if (!(propertyBags[i].TryGetProperty(ConversationActionItemSchema.ConversationActionVersion) is PropertyError))
                                                    {
                                                        int version = (int)propertyBags[i].TryGetProperty(ConversationActionItemSchema.ConversationActionVersion);
                                                        if (ConversationActionItem.GetMajorVersion(version) >= 4)
                                                        {
                                                            list.Add(propertyBags[i][ItemSchema.Id] as VersionedId);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        return((list.Count == 0) ? null : list);
                                    }
                                }
                                result = null;
                            }
                        }
                    }
                }
            }
            catch (ObjectNotFoundException)
            {
                result = null;
            }
            return(result);
        }
        public static void ChunkSmsConversation(IXSOFactory xsoFactory, IMailboxSession session, ConversationIndex conversationIndex, ConversationIndexTrackingEx conversationIndexTrackingEx)
        {
            Util.ThrowOnNullArgument(session, "session");
            Util.ThrowOnNullArgument(conversationIndex, "conversationIndex");
            byte[]    conversationIdBytes = ConversationId.Create(conversationIndex.Guid).GetBytes();
            int       conversationIdHash  = (int)AllItemsFolderHelper.GetHashValue(conversationIdBytes);
            Stopwatch stopwatch           = Stopwatch.StartNew();
            List <IStorePropertyBag> list = xsoFactory.RunQueryOnAllItemsFolder <List <IStorePropertyBag> >(session, AllItemsFolderHelper.SupportedSortBy.ConversationIdHash, conversationIdHash, null, delegate(QueryResult queryResult)
            {
                List <IStorePropertyBag> list2 = null;
                bool flag = false;
                while (!flag)
                {
                    IStorePropertyBag[] propertyBags = queryResult.GetPropertyBags(10);
                    if (propertyBags == null || propertyBags.Length <= 0)
                    {
                        break;
                    }
                    for (int i = 0; i < propertyBags.Length; i++)
                    {
                        int?num2 = propertyBags[i].TryGetProperty(ItemSchema.ConversationIdHash) as int?;
                        if (num2 == null)
                        {
                            break;
                        }
                        if (num2.Value != conversationIdHash)
                        {
                            flag = true;
                            break;
                        }
                        byte[] array = propertyBags[i].TryGetProperty(InternalSchema.MapiConversationId) as byte[];
                        if (array != null && Util.CompareByteArray(conversationIdBytes, array))
                        {
                            if (list2 == null)
                            {
                                list2 = new List <IStorePropertyBag>(10);
                            }
                            list2.Add(propertyBags[i]);
                        }
                    }
                }
                return(list2);
            }, new StorePropertyDefinition[]
            {
                ItemSchema.Id,
                ItemSchema.ConversationIdHash,
                ItemSchema.ReceivedTime,
                InternalSchema.MapiConversationId
            });

            stopwatch.Stop();
            if (conversationIndexTrackingEx != null)
            {
                conversationIndexTrackingEx.Trace("SBSMSCID", stopwatch.ElapsedMilliseconds.ToString());
            }
            if (list == null || list.Count < 79)
            {
                return;
            }
            list.Sort(delegate(IStorePropertyBag x, IStorePropertyBag y)
            {
                ExDateTime?exDateTime  = x.TryGetProperty(ItemSchema.ReceivedTime) as ExDateTime?;
                ExDateTime?exDateTime2 = y.TryGetProperty(ItemSchema.ReceivedTime) as ExDateTime?;
                if (exDateTime == null && exDateTime2 == null)
                {
                    return(0);
                }
                if (exDateTime == null)
                {
                    return(1);
                }
                if (exDateTime2 == null)
                {
                    return(-1);
                }
                return(exDateTime.Value.CompareTo(exDateTime2.Value));
            });
            string str = conversationIndex.Guid.ToString("D").Substring("472e2878-19b1-4ac1-a21a-".Length);
            string text;

            do
            {
                text = Guid.NewGuid().ToString("D").Substring(0, "472e2878-19b1-4ac1-a21a-".Length);
            }while (string.Equals(text, "472e2878-19b1-4ac1-a21a-"));
            ConversationIndex conversationIndex2 = ConversationIndex.Create(new Guid(text + str));
            int num = 0;

            while (num < list.Count && num < 50)
            {
                VersionedId versionedId = (VersionedId)list[num].TryGetProperty(ItemSchema.Id);
                if (versionedId != null)
                {
                    StoreObjectId objectId = versionedId.ObjectId;
                    if (objectId != null)
                    {
                        using (IMessageItem messageItem = xsoFactory.BindToMessage(session, objectId, null))
                        {
                            messageItem.OpenAsReadWrite();
                            messageItem[ItemSchema.ConversationIndex]         = conversationIndex2.ToByteArray();
                            messageItem[ItemSchema.ConversationIndexTracking] = true;
                            messageItem.Save(SaveMode.ResolveConflicts);
                        }
                    }
                }
                num++;
            }
        }
        public static IList <StoreId> QueryConversationActionsFolder(MailboxSession session, ConversationId conversationId, int maxRowCount)
        {
            int num;

            return(ConversationActionItem.QueryConversationActionsFolder(session, conversationId, maxRowCount, out num));
        }
예제 #21
0
 public static Conversation Load(MailboxSession session, ConversationId conversationId, IList <StoreObjectId> foldersToIgnore, params PropertyDefinition[] propertyDefinitions)
 {
     return(Conversation.Load(session, conversationId, foldersToIgnore, false, propertyDefinitions));
 }
예제 #22
0
 public static ConversationIndex Create(ConversationId conversationId)
 {
     Util.ThrowOnNullArgument(conversationId, "conversationId");
     return(ConversationIndex.Create(new Guid(conversationId.GetBytes())));
 }
예제 #23
0
        public static Conversation Load(MailboxSession session, ConversationId conversationId, IList <StoreObjectId> folderIds, bool useFolderIdsAsExclusionList, bool isIrmEnabled, params PropertyDefinition[] propertyDefinitions)
        {
            ConversationFactory conversationFactory = new ConversationFactory(session);

            return(conversationFactory.CreateConversation(conversationId, folderIds, useFolderIdsAsExclusionList, isIrmEnabled, propertyDefinitions));
        }
예제 #24
0
        public ManifestCallbackStatus Change(byte[] entryId, byte[] sourceKey, byte[] changeKey, byte[] changeList, DateTime lastModifiedTime, ManifestChangeType changeType, bool associated, PropValue[] properties)
        {
            EnumValidator.ThrowIfInvalid <ManifestChangeType>(changeType, "changeType");
            if (ExTraceGlobals.SyncTracer.IsTraceEnabled(TraceType.InfoTrace))
            {
                this.TraceChangeChangeCallbackProps(entryId, sourceKey, changeKey, changeList, lastModifiedTime, changeType, associated, properties);
            }
            int?           num                        = null;
            string         text                       = null;
            bool           read                       = false;
            ConversationId conversationId             = null;
            bool           firstMessageInConversation = false;
            ExDateTime?    filterDate                 = null;

            foreach (PropValue propValue in properties)
            {
                if (!propValue.IsError())
                {
                    PropTag propTag = propValue.PropTag;
                    if (propTag <= PropTag.MessageDeliveryTime)
                    {
                        if (propTag != PropTag.MessageClass)
                        {
                            ConversationIndex index;
                            if (propTag != PropTag.ConversationIndex)
                            {
                                if (propTag == PropTag.MessageDeliveryTime)
                                {
                                    if (propValue.PropType == PropType.SysTime)
                                    {
                                        filterDate = new ExDateTime?((ExDateTime)propValue.GetDateTime());
                                    }
                                }
                            }
                            else if (propValue.PropType == PropType.Binary && ConversationIndex.TryCreate(propValue.GetBytes(), out index) && index != ConversationIndex.Empty && index.Components != null && index.Components.Count == 1)
                            {
                                firstMessageInConversation = true;
                            }
                        }
                        else if (propValue.PropType == PropType.String)
                        {
                            text = propValue.GetString();
                        }
                    }
                    else if (propTag != PropTag.MessageFlags)
                    {
                        if (propTag != PropTag.InternetArticleNumber)
                        {
                            if (propTag == PropTag.ConversationId)
                            {
                                if (propValue.PropType == PropType.Binary)
                                {
                                    conversationId = ConversationId.Create(propValue.GetBytes());
                                }
                            }
                        }
                        else
                        {
                            if (propValue.PropType != PropType.Int)
                            {
                                return(ManifestCallbackStatus.Continue);
                            }
                            num = new int?(propValue.GetInt());
                        }
                    }
                    else if (propValue.PropType == PropType.Int)
                    {
                        MessageFlags @int = (MessageFlags)propValue.GetInt();
                        read = ((@int & MessageFlags.IsRead) == MessageFlags.IsRead);
                    }
                }
            }
            if (changeType == ManifestChangeType.Add || changeType == ManifestChangeType.Change)
            {
                if (num == null)
                {
                    return(ManifestCallbackStatus.Continue);
                }
                StoreObjectId        id = StoreObjectId.FromProviderSpecificId(entryId, (text == null) ? StoreObjectType.Unknown : ObjectClass.GetObjectType(text));
                MailboxSyncItemId    mailboxSyncItemId    = MailboxSyncItemId.CreateForNewItem(id);
                MailboxSyncWatermark mailboxSyncWatermark = MailboxSyncWatermark.CreateForSingleItem();
                mailboxSyncWatermark.UpdateWithChangeNumber(num.Value, read);
                ServerManifestEntry serverManifestEntry = this.mailboxSyncProvider.CreateItemChangeManifestEntry(mailboxSyncItemId, mailboxSyncWatermark);
                serverManifestEntry.IsNew                      = (changeType == ManifestChangeType.Add);
                serverManifestEntry.MessageClass               = text;
                serverManifestEntry.ConversationId             = conversationId;
                serverManifestEntry.FirstMessageInConversation = firstMessageInConversation;
                serverManifestEntry.FilterDate                 = filterDate;
                mailboxSyncItemId.ChangeKey                    = changeKey;
                this.lastServerManifestEntry                   = serverManifestEntry;
            }
            else
            {
                StoreObjectId     id2 = StoreObjectId.FromProviderSpecificId(entryId, StoreObjectType.Unknown);
                MailboxSyncItemId mailboxSyncItemId2 = MailboxSyncItemId.CreateForExistingItem(this.mailboxSyncProvider.FolderSync, id2);
                if (mailboxSyncItemId2 == null)
                {
                    return(ManifestCallbackStatus.Continue);
                }
                this.lastServerManifestEntry = MailboxSyncProvider.CreateItemDeleteManifestEntry(mailboxSyncItemId2);
                this.lastServerManifestEntry.ConversationId = conversationId;
            }
            return(this.CheckYieldOrStop());
        }
예제 #25
0
 public ConversationIndex UpdateGuid(ConversationId conversationId)
 {
     return(this.UpdateGuid(conversationId.GetBytes()));
 }
        internal static QueryFilter NativeFilterToConversationIdBasedSmartFilter(this SmartPropertyDefinition conversationIdSmartPropertyDefinition, QueryFilter filter, PropertyDefinition conversationIdNativePropertyDefinition)
        {
            SinglePropertyFilter singlePropertyFilter = filter as SinglePropertyFilter;

            if (singlePropertyFilter != null && singlePropertyFilter.Property.Equals(conversationIdNativePropertyDefinition))
            {
                ComparisonFilter comparisonFilter = filter as ComparisonFilter;
                if (comparisonFilter != null)
                {
                    return(new ComparisonFilter(comparisonFilter.ComparisonOperator, conversationIdSmartPropertyDefinition, ConversationId.Create((byte[])comparisonFilter.PropertyValue)));
                }
                ExistsFilter existsFilter = filter as ExistsFilter;
                if (existsFilter != null)
                {
                    return(new ExistsFilter(conversationIdSmartPropertyDefinition));
                }
            }
            return(null);
        }
예제 #27
0
 public static Conversation Load(MailboxSession session, ConversationId conversationId, bool isIrmEnabled, params PropertyDefinition[] propertyDefinitions)
 {
     return(Conversation.Load(session, conversationId, null, isIrmEnabled, propertyDefinitions));
 }
예제 #28
0
 public static ConversationId RetrieveConversationId(IList <byte> conversationIndexInBytes)
 {
     return(ConversationId.Create(ConversationIndex.Create(conversationIndexInBytes)));
 }