コード例 #1
0
        private AdrEntry GetAdrEntry(CoreRecipient coreRecipient)
        {
            ICollection <PropertyDefinition> allFoundProperties = coreRecipient.PropertyBag.AllFoundProperties;
            ICollection <PropTag>            collection         = PropertyTagCache.Cache.PropTagsFromPropertyDefinitions <PropertyDefinition>(this.storeSession.Mailbox.MapiStore, this.storeSession, false, allFoundProperties);
            List <PropValue> list = new List <PropValue>(collection.Count);
            int num = 0;

            using (IEnumerator <PropTag> enumerator = collection.GetEnumerator())
            {
                foreach (PropertyDefinition propertyDefinition in allFoundProperties)
                {
                    if (!enumerator.MoveNext())
                    {
                        throw new InvalidOperationException("PropTag enumerator out of step with definitions");
                    }
                    object obj = coreRecipient.PropertyBag.TryGetProperty(propertyDefinition);
                    object obj2;
                    if (obj is ExDateTime)
                    {
                        obj2 = (DateTime)((ExDateTime)obj).ToUtc();
                    }
                    else
                    {
                        obj2 = obj;
                    }
                    if (!(obj2 is PropertyError))
                    {
                        list.Add(new PropValue(enumerator.Current, obj2));
                    }
                    num++;
                }
            }
            return(new AdrEntry(list.ToArray()));
        }
コード例 #2
0
        public Recipient Add(Participant participant, RecipientItemType recipItemType)
        {
            CoreRecipient coreRecipient = base.CreateCoreRecipient(new CoreRecipient.SetDefaultPropertiesDelegate(Recipient.SetDefaultRecipientProperties), participant);
            Recipient     recipient     = this.ConstructStronglyTypedRecipient(coreRecipient);

            recipient.RecipientItemType = recipItemType;
            return(recipient);
        }
コード例 #3
0
        internal Attendee AddClone(Attendee item)
        {
            CoreRecipient coreRecipient = base.CoreRecipientCollection.CreateCoreRecipient(item.CoreRecipient);
            Attendee      result        = this.ConstructStronglyTypedRecipient(coreRecipient);

            this.ReportRecipientChange(LastChangeAction.RecipientAdded);
            return(result);
        }
コード例 #4
0
 void IRecipientChangeTracker.RemoveUnchangedRecipient(CoreRecipient coreRecipient)
 {
     if (coreRecipient.Participant != null)
     {
         this.removedRecipients[coreRecipient.Participant] = coreRecipient;
     }
     this.removedRecipientIds.Add(coreRecipient.RowId);
 }
コード例 #5
0
 internal CoreRecipient(CoreRecipient sourceCoreRecipient, int rowId, IRecipientChangeTracker destinationRecipientChangeTracker, ExTimeZone destinationTimeZone)
 {
     this.participant                       = sourceCoreRecipient.participant;
     this.recipientChangeTracker            = destinationRecipientChangeTracker;
     this.propertyBag                       = new CoreRecipient.CoreRecipientPropertyBag(sourceCoreRecipient.propertyBag, this);
     this.propertyBag.ExTimeZone            = destinationTimeZone;
     this.propertyBag[InternalSchema.RowId] = rowId;
     this.EndInitialization();
     this.OnAddRecipient();
 }
コード例 #6
0
        void IRecipientChangeTracker.AddRecipient(CoreRecipient coreRecipient, out bool considerRecipientModified)
        {
            considerRecipientModified = false;
            int num = this.removedRecipientIds.IndexOf(coreRecipient.RowId);

            if (num != -1)
            {
                this.removedRecipientIds.RemoveAt(num);
                this.modifiedRecipients.Add(coreRecipient);
                considerRecipientModified = true;
                return;
            }
            int num2 = this.addedRecipients.BinarySearch(coreRecipient, RecipientChangeTracker.CoreRecipientComparer.Default);

            this.addedRecipients.Insert(~num2, coreRecipient);
        }
コード例 #7
0
        private void CopyRecipientToMessage(ICoreItem coreItem, ConversionRecipientEntry entry)
        {
            CoreRecipient coreRecipient = coreItem.Recipients.CreateCoreRecipient(new CoreRecipient.SetDefaultPropertiesDelegate(Recipient.SetDefaultRecipientProperties), entry.Participant);

            coreRecipient.RecipientItemType = entry.RecipientItemType;
            foreach (NativeStorePropertyDefinition nativeStorePropertyDefinition in entry.AllNativeProperties)
            {
                object obj = entry.TryGetProperty(nativeStorePropertyDefinition);
                coreRecipient.PropertyBag.TryGetProperty(nativeStorePropertyDefinition);
                if (!(obj is PropertyError) && !RecipientBase.ImmutableProperties.Contains(nativeStorePropertyDefinition))
                {
                    coreRecipient.PropertyBag.SetProperty(nativeStorePropertyDefinition, obj);
                }
            }
            coreRecipient.InternalUpdateParticipant(entry.Participant);
        }
コード例 #8
0
 void IRecipientChangeTracker.RemoveModifiedRecipient(CoreRecipient coreRecipient)
 {
     for (int i = 0; i < this.modifiedRecipients.Count; i++)
     {
         if (this.modifiedRecipients[i] == coreRecipient)
         {
             this.modifiedRecipients.RemoveAt(i);
             break;
         }
     }
     if (coreRecipient.Participant != null)
     {
         this.removedRecipients[coreRecipient.Participant] = coreRecipient;
     }
     this.removedRecipientIds.Add(coreRecipient.RowId);
 }
コード例 #9
0
 internal bool FindRemovedRecipient(Participant participant, out CoreRecipient recipient)
 {
     return(this.recipientChangeTracker.FindRemovedRecipient(participant, out recipient));
 }
コード例 #10
0
 protected static void SetDefaultRecipientBaseProperties(CoreRecipient coreRecipient)
 {
     coreRecipient.PropertyBag[InternalSchema.RecipientFlags] = 1;
 }
コード例 #11
0
 internal CoreRecipientPropertyBag(CoreRecipient.CoreRecipientPropertyBag propertyBag, CoreRecipient coreRecipient) : base(propertyBag)
 {
     this.coreRecipient = coreRecipient;
 }
コード例 #12
0
 internal CoreRecipientPropertyBag(CoreRecipient coreRecipient)
 {
     this.coreRecipient = coreRecipient;
     base.SetAllPropertiesLoaded();
 }
コード例 #13
0
 protected override Recipient ConstructStronglyTypedRecipient(CoreRecipient coreRecipient)
 {
     return(new Recipient(coreRecipient));
 }
コード例 #14
0
 protected override Attendee ConstructStronglyTypedRecipient(CoreRecipient coreRecipient)
 {
     return(new Attendee(coreRecipient));
 }
コード例 #15
0
ファイル: Recipient.cs プロジェクト: YHZX2013/exchange_diff
 internal Recipient(CoreRecipient coreRecipient) : base(coreRecipient)
 {
 }
コード例 #16
0
ファイル: Recipient.cs プロジェクト: YHZX2013/exchange_diff
 internal static void SetDefaultRecipientProperties(CoreRecipient coreRecipient)
 {
     RecipientBase.SetDefaultRecipientBaseProperties(coreRecipient);
     coreRecipient.RecipientItemType = RecipientItemType.To;
 }
コード例 #17
0
 internal RecipientBase(CoreRecipient coreRecipient)
 {
     this.coreRecipient = coreRecipient;
     this.propertyBag   = new RecipientBase.RecipientBasePropertyBag(this.coreRecipient.GetMemoryPropertyBag());
 }
コード例 #18
0
ファイル: Attendee.cs プロジェクト: YHZX2013/exchange_diff
 internal Attendee(CoreRecipient coreRecipient) : base(coreRecipient)
 {
 }
コード例 #19
0
 void IRecipientChangeTracker.OnModifyRecipient(CoreRecipient coreRecipient)
 {
     this.modifiedRecipients.Add(coreRecipient);
 }
コード例 #20
0
        private Attendee GetAttendeeToAdd(Participant participant)
        {
            CoreRecipient coreRecipient = base.CreateCoreRecipient(new CoreRecipient.SetDefaultPropertiesDelegate(Attendee.SetDefaultAttendeeProperties), participant);

            return(this.ConstructStronglyTypedRecipient(coreRecipient));
        }
コード例 #21
0
        void IRecipientChangeTracker.RemoveAddedRecipient(CoreRecipient coreRecipient)
        {
            int index = this.addedRecipients.BinarySearch(coreRecipient, RecipientChangeTracker.CoreRecipientComparer.Default);

            this.addedRecipients.RemoveAt(index);
        }
コード例 #22
0
 internal bool FindRemovedRecipient(Participant participant, out CoreRecipient recipient)
 {
     return(this.removedRecipients.TryGetValue(participant, out recipient));
 }
コード例 #23
0
ファイル: Attendee.cs プロジェクト: YHZX2013/exchange_diff
 internal static void SetDefaultAttendeeProperties(CoreRecipient coreRecipient)
 {
     RecipientBase.SetDefaultRecipientBaseProperties(coreRecipient);
     coreRecipient.RecipientItemType = Attendee.AttendeeTypeToRecipientItemType(AttendeeType.Required);
     coreRecipient.PropertyBag[InternalSchema.RecipientTrackStatus] = 0;
 }
コード例 #24
0
        public static bool IsItemLegallyDirty(StoreSession session, CoreItem item, bool verifyLegallyDirty, out List <string> dirtyProperties)
        {
            dirtyProperties = null;
            if (COWSettings.IsCalendarRepairAssistantAction(session))
            {
                ExTraceGlobals.SessionTracer.TraceWarning <CoreItem>((long)session.GetHashCode(), "Update Item {0} skipped because the action was generated by Calendar Repair Assistant.", item);
                return(false);
            }
            if (item.PropertyBag.GetValueOrDefault <bool>(InternalSchema.IsDraft))
            {
                ExTraceGlobals.SessionTracer.TraceWarning <CoreItem>((long)session.GetHashCode(), "Update Item {0} skipped because it is a draft.", item);
                return(false);
            }
            if (item.Id == null)
            {
                ExTraceGlobals.SessionTracer.TraceWarning <CoreItem>((long)session.GetHashCode(), "Update Item {0} skipped because it does not have an id.", item);
                return(false);
            }
            if (item.PropertyBag.GetValueOrDefault <bool>(InternalSchema.IsAssociated))
            {
                ExTraceGlobals.SessionTracer.TraceWarning <CoreItem>((long)session.GetHashCode(), "Update Item {0} skipped because it is an associated item.", item);
                return(false);
            }
            if (item.Id == null)
            {
                ExTraceGlobals.SessionTracer.TraceWarning <CoreItem>((long)session.GetHashCode(), "Update Item {0} skipped because the id was null.", item);
                return(false);
            }
            string valueOrDefault = item.PropertyBag.GetValueOrDefault <string>(InternalSchema.ItemClass, string.Empty);

            if (ObjectClass.IsOfClass(valueOrDefault, "IPM.Post.RSS"))
            {
                ExTraceGlobals.SessionTracer.TraceWarning <CoreItem>((long)session.GetHashCode(), "Update Item {0} skipped because it is a RSS item.", item);
                return(false);
            }
            Schema schema = ObjectClass.GetSchema(valueOrDefault);

            if (!(schema is ItemSchema))
            {
                schema = ItemSchema.Instance;
            }
            bool isLegallyDirty = item.IsLegallyDirty;
            CoreRecipientCollection  recipients           = ((ICoreItem)item).Recipients;
            CoreAttachmentCollection attachmentCollection = ((ICoreItem)item).AttachmentCollection;
            bool flag  = (recipients != null && recipients.IsDirty) || item.IsLegallyDirtyProperty("RecipientCollection");
            bool flag2 = (attachmentCollection != null && attachmentCollection.IsDirty) || item.IsLegallyDirtyProperty("AttachmentCollection");

            if (!isLegallyDirty && !item.PropertyBag.IsDirty && !flag && !flag2)
            {
                ExTraceGlobals.SessionTracer.TraceWarning <CoreItem>((long)session.GetHashCode(), "Update Item {0} skipped because the property bag is not dirty.", item);
                return(false);
            }
            StorePropertyDefinition[] array = (from x in schema.LegalTrackingProperties
                                               where item.PropertyBag.IsPropertyDirty(x) || item.IsLegallyDirtyProperty(x.Name)
                                               select x).ToArray <StorePropertyDefinition>();
            if (array.Length == 0 && !flag && !flag2)
            {
                ExTraceGlobals.SessionTracer.TraceWarning <CoreItem>((long)session.GetHashCode(), "Update Item {0} skipped because the property bag is not legally dirty.", item);
                return(false);
            }
            dirtyProperties = new List <string>();
            if (!verifyLegallyDirty)
            {
                dirtyProperties = (from x in array
                                   select x.Name).ToList <string>();
                if (flag)
                {
                    dirtyProperties.Add("RecipientCollection");
                }
                if (flag2)
                {
                    dirtyProperties.Add("AttachmentCollection");
                }
            }
            else
            {
                using (CoreItem coreItem = CoreItem.Bind(session, item.Id, array))
                {
                    CoreRecipientCollection recipients2 = coreItem.Recipients;
                    if (flag)
                    {
                        flag = false;
                        int num  = (recipients == null) ? 0 : recipients.Count;
                        int num2 = (recipients2 == null) ? 0 : recipients2.Count;
                        if (num == num2)
                        {
                            if (recipients == null || recipients2 == null)
                            {
                                goto IL_36E;
                            }
                            using (IEnumerator <CoreRecipient> enumerator = recipients.GetEnumerator())
                            {
                                while (enumerator.MoveNext())
                                {
                                    CoreRecipient value = enumerator.Current;
                                    if (!recipients2.Contains(value, COWDumpster.CoreRecipientParticipantEqualityComparer.Default))
                                    {
                                        flag = true;
                                        break;
                                    }
                                }
                                goto IL_36E;
                            }
                        }
                        flag = true;
                    }
                    else
                    {
                        int num3 = (recipients == null) ? 0 : recipients.Count;
                        int num4 = (recipients2 == null) ? 0 : recipients2.Count;
                        flag = (num3 != num4);
                    }
IL_36E:
                    if (flag)
                    {
                        ExTraceGlobals.SessionTracer.TraceWarning <CoreItem>((long)session.GetHashCode(), "Update Item {0} is dirty because the recipient collection is dirty.", item);
                        dirtyProperties.Add("RecipientCollection");
                    }
                    if (!flag2)
                    {
                        CoreAttachmentCollection attachmentCollection2 = coreItem.AttachmentCollection;
                        int num5 = (attachmentCollection == null) ? 0 : attachmentCollection.Count;
                        int num6 = (attachmentCollection2 == null) ? 0 : attachmentCollection2.Count;
                        flag2 = (num5 != num6);
                    }
                    if (flag2)
                    {
                        ExTraceGlobals.SessionTracer.TraceWarning <CoreItem>((long)session.GetHashCode(), "Update Item {0} is dirty because the attachment collection is dirty.", item);
                        dirtyProperties.Add("AttachmentCollection");
                    }
                    foreach (StorePropertyDefinition propertyDefinition in array)
                    {
                        object x2 = item.PropertyBag.TryGetProperty(propertyDefinition);
                        object y  = coreItem.PropertyBag.TryGetProperty(propertyDefinition);
                        if (!COWDumpster.PropertyValuesAreEqual(propertyDefinition, x2, y))
                        {
                            ExTraceGlobals.SessionTracer.TraceWarning <CoreItem, string, PropertyDefinition>((long)session.GetHashCode(), "Update Item {0}, class {1} is dirty because the {2} property is dirty.", item, valueOrDefault, propertyDefinition);
                            dirtyProperties.Add(propertyDefinition.Name);
                        }
                    }
                }
            }
            if (dirtyProperties.Count > 0)
            {
                ExTraceGlobals.SessionTracer.TraceWarning((long)session.GetHashCode(), "Update Item {0}, class {1} is {2} dirty with {3} properties changed", new object[]
                {
                    item,
                    valueOrDefault,
                    verifyLegallyDirty ? "verified" : "not verified",
                    dirtyProperties.Count
                });
                return(true);
            }
            ExTraceGlobals.SessionTracer.TraceWarning <CoreItem, string, int>((long)session.GetHashCode(), "Update Item {0}, class {1} skipped because no legal tracking property was found dirty out of {2} modified legal tracking properties.", item, valueOrDefault, array.Length);
            dirtyProperties = null;
            return(false);
        }