Exemple #1
0
 internal void ApplyChangesToExceptionAttendeeCollection(MapiMessage exceptionMessage)
 {
     if (this.IsDirty)
     {
         this.Cleanup();
         for (int i = 0; i < this.masterAttendeeCount; i++)
         {
             Attendee attendee = this.attendeeCollection[i];
             if (attendee.IsDirty && !this.exceptionAttendeeCollection.Contains(attendee))
             {
                 this.exceptionAttendeeCollection.AddClone(attendee);
             }
         }
         if (this.exceptionAttendeeCollection.CoreItem.MapiMessage != exceptionMessage)
         {
             CoreRecipientCollection recipients         = this.occurrence.OccurrencePropertyBag.ExceptionMessage.CoreItem.Recipients;
             AttendeeCollection      attendeeCollection = new AttendeeCollection(recipients);
             foreach (Attendee attendee2 in this.exceptionAttendeeCollection)
             {
                 if (attendee2.IsDirty)
                 {
                     attendeeCollection.AddClone(attendee2);
                 }
             }
             this.exceptionAttendeeCollection = attendeeCollection;
             this.occurrence.OccurrencePropertyBag.MasterCalendarItem.AbandonRecipientChanges();
             this.LoadMasterAttendeeCollection();
             this.BuildOccurrenceAttendeeCollection();
         }
     }
 }
Exemple #2
0
 internal void CopyRecipientsFrom(CoreRecipientCollection recipientCollection)
 {
     this.CheckDisposed(null);
     foreach (CoreRecipient sourceCoreRecipient in recipientCollection.recipientList)
     {
         this.CreateCoreRecipient(sourceCoreRecipient);
     }
 }
Exemple #3
0
 internal AttendeeCollection(CoreRecipientCollection coreRecipientCollection) : base(coreRecipientCollection)
 {
     if (coreRecipientCollection.CoreItem.Session != null)
     {
         this.Cleanup();
         this.LoadIsDistributionList();
     }
 }
Exemple #4
0
 internal override IAttendeeCollection FetchAttendeeCollection(bool forceOpen)
 {
     this.CheckDisposed("FetchAttendeeCollection");
     if (this.attendees == null)
     {
         CoreRecipientCollection recipientCollection = base.CoreItem.GetRecipientCollection(forceOpen);
         if (recipientCollection != null)
         {
             this.attendees = new AttendeeCollection(recipientCollection);
             base.ResetAttendeeCache();
         }
     }
     return(this.attendees);
 }
 internal override IAttendeeCollection FetchAttendeeCollection(bool forceOpen)
 {
     if (this.attendees == null)
     {
         CoreRecipientCollection coreRecipientCollection = null;
         if (this.OccurrencePropertyBag.ExceptionMessage != null)
         {
             coreRecipientCollection = this.OccurrencePropertyBag.ExceptionMessage.CoreItem.GetRecipientCollection(forceOpen);
         }
         CoreRecipientCollection recipientCollection = this.OccurrencePropertyBag.MasterCalendarItem.CoreItem.GetRecipientCollection(forceOpen);
         if (coreRecipientCollection == null && recipientCollection == null)
         {
             return(null);
         }
         this.attendees = new OccurrenceAttendeeCollection(this);
         base.ResetAttendeeCache();
     }
     return(this.attendees);
 }
Exemple #6
0
        private void CopyRecipientData(Item item)
        {
            RecipientCollection     recipientCollection  = null;
            CoreRecipientCollection recipientCollection2 = item.CoreItem.GetRecipientCollection(true);

            if (recipientCollection2 != null)
            {
                recipientCollection = new RecipientCollection(recipientCollection2);
            }
            foreach (Recipient recipient in recipientCollection)
            {
                ConversionRecipientEntry conversionRecipientEntry = new ConversionRecipientEntry(recipient.Participant, recipient.RecipientItemType);
                foreach (PropertyDefinition propertyDefinition in recipient.CoreRecipient.PropertyBag.AllFoundProperties)
                {
                    StorePropertyDefinition property = (StorePropertyDefinition)propertyDefinition;
                    object obj = recipient.TryGetProperty(property);
                    if (!(obj is PropertyError))
                    {
                        conversionRecipientEntry.SetProperty(property, obj, false);
                    }
                }
                base.AddRecipient(conversionRecipientEntry);
            }
        }
        protected override bool ExtractToAndCC(PropertyBag.BasicPropertyStore propertyBag, ComplexParticipantExtractorBase <T> .ParticipantConverter converter, IEqualityComparer <T> comparer, out IDictionary <RecipientItemType, HashSet <T> > recipientTable)
        {
            ICoreItem coreItem = propertyBag.Context.CoreObject as ICoreItem;

            recipientTable = null;
            if (coreItem != null)
            {
                CoreRecipientCollection recipientCollection = coreItem.GetRecipientCollection(true);
                if (recipientCollection != null)
                {
                    recipientTable = ComplexParticipantExtractorBase <T> .InstantiateResultType(comparer);

                    foreach (CoreRecipient coreRecipient in recipientCollection)
                    {
                        if (coreRecipient.RecipientItemType == RecipientItemType.To || coreRecipient.RecipientItemType == RecipientItemType.Cc)
                        {
                            recipientTable[coreRecipient.RecipientItemType].Add(converter(coreRecipient.Participant));
                        }
                    }
                    return(true);
                }
            }
            return(false);
        }
Exemple #8
0
        private void LoadMasterAttendeeCollection()
        {
            CoreRecipientCollection recipients = this.occurrence.OccurrencePropertyBag.MasterCalendarItem.CoreItem.Recipients;

            this.masterAttendeeCollection = new AttendeeCollection(recipients);
        }
Exemple #9
0
 internal RecipientCollection(CoreRecipientCollection coreRecipientCollection) : base(coreRecipientCollection)
 {
 }
Exemple #10
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);
        }