Beispiel #1
0
        internal ConflictResolutionResult ResolveConflicts(Dictionary <PropertyDefinition, AcrPropertyProfile.ValuesToResolve> propertyValuesToResolve)
        {
            Dictionary <PropertyDefinition, PropertyConflict> dictionary = new Dictionary <PropertyDefinition, PropertyConflict>(propertyValuesToResolve.Count);

            foreach (KeyValuePair <PropertyDefinition, AcrPropertyProfile.ValuesToResolve> keyValuePair in propertyValuesToResolve)
            {
                AcrPropertyProfile acrPropertyProfile = this[keyValuePair.Key];
                if (!dictionary.ContainsKey(keyValuePair.Key))
                {
                    if (acrPropertyProfile != null)
                    {
                        AcrProfile.ResolveConflicts(dictionary, acrPropertyProfile.Resolver, propertyValuesToResolve, acrPropertyProfile.PropertiesToResolve);
                    }
                    else
                    {
                        AcrProfile.ResolveConflicts(dictionary, this.genericResolver, propertyValuesToResolve, new PropertyDefinition[]
                        {
                            keyValuePair.Key
                        });
                    }
                }
            }
            SaveResult saveResult = SaveResult.Success;

            foreach (PropertyConflict propertyConflict in dictionary.Values)
            {
                if (!propertyConflict.ConflictResolvable)
                {
                    saveResult = SaveResult.IrresolvableConflict;
                    break;
                }
                saveResult = SaveResult.SuccessWithConflictResolution;
            }
            return(new ConflictResolutionResult(saveResult, Util.CollectionToArray <PropertyConflict>(dictionary.Values)));
        }
Beispiel #2
0
        private static AcrProfile CreateFollowupFlagProfile()
        {
            AcrProfile acrProfile = new AcrProfile(null, new AcrProfile[]
            {
                AcrProfile.ReminderProfile
            });

            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToEarlierTime), false, new StorePropertyDefinition[]
            {
                InternalSchema.ReplyTime
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToOredValue), false, new StorePropertyDefinition[]
            {
                InternalSchema.IsReplyRequested
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToOredValue), false, new StorePropertyDefinition[]
            {
                InternalSchema.IsResponseRequested
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToHighestIntValue), false, new StorePropertyDefinition[]
            {
                InternalSchema.MapiFlagStatus
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToHighestIntValue), false, new StorePropertyDefinition[]
            {
                InternalSchema.TaskStatus
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
            {
                InternalSchema.FlagRequest
            });
            return(acrProfile);
        }
Beispiel #3
0
        private static AcrProfile CreateCommonMessageProfile()
        {
            AcrProfile acrProfile = new AcrProfile(null, new AcrProfile[0]);

            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToHighestPriorityAndImportance), false, new StorePropertyDefinition[]
            {
                InternalSchema.MapiPriority,
                InternalSchema.MapiImportance
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToHighestSensitivity), false, new StorePropertyDefinition[]
            {
                InternalSchema.MapiSensitivity,
                InternalSchema.Privacy
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToMergedStringValues), false, new StorePropertyDefinition[]
            {
                InternalSchema.Categories
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValueIfServerValueNotModified), true, new StorePropertyDefinition[]
            {
                InternalSchema.MapiSubject
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValueIfServerValueNotModified), true, new StorePropertyDefinition[]
            {
                InternalSchema.AppointmentStateInternal
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToModifiedValue), false, new StorePropertyDefinition[]
            {
                InternalSchema.ConversationIndexTracking
            });
            return(acrProfile);
        }
 private ItemCreateInfo(StoreObjectType type, Schema schema, AcrProfile acrProfile, ItemCreateInfo.ItemCreator creator)
 {
     this.Type       = type;
     this.Schema     = schema;
     this.AcrProfile = acrProfile;
     this.Creator    = creator;
 }
Beispiel #5
0
 private static void ResolveConflicts(Dictionary <PropertyDefinition, PropertyConflict> conflicts, AcrPropertyResolver resolver, Dictionary <PropertyDefinition, AcrPropertyProfile.ValuesToResolve> propertyValuesToResolve, PropertyDefinition[] propertiesToResolve)
 {
     AcrPropertyProfile.ValuesToResolve[] array        = AcrProfile.FilterValuesToResolve(propertyValuesToResolve, propertiesToResolve);
     AcrPropertyProfile.ValuesToResolve[] dependencies = AcrProfile.FilterValuesToResolve(propertyValuesToResolve, resolver.Dependencies);
     object[] array2 = resolver.Resolve(array, dependencies);
     for (int i = 0; i < propertiesToResolve.Length; i++)
     {
         PropertyConflict value = new PropertyConflict(propertiesToResolve[i], array[i].OriginalValue, array[i].ClientValue, array[i].ServerValue, (array2 != null) ? array2[i] : null, array2 != null);
         conflicts.Add(propertiesToResolve[i], value);
     }
 }
Beispiel #6
0
        private static AcrProfile CreateMailboxAssociationProfile()
        {
            AcrProfile acrProfile = new AcrProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), new AcrProfile[]
            {
                AcrProfile.BlankProfile
            });

            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToIncrementHighestIntValue), false, new StorePropertyDefinition[]
            {
                InternalSchema.MailboxAssociationCurrentVersion
            });
            return(acrProfile);
        }
Beispiel #7
0
 internal AcrPropertyBag(PersistablePropertyBag propertyBag, AcrProfile profile, StoreObjectId itemId, IPropertyBagFactory propertyBagFactory, byte[] openChangeKey)
 {
     this.propertyBag           = propertyBag;
     base.PrefetchPropertyArray = this.propertyBag.PrefetchPropertyArray;
     this.profile            = profile;
     this.itemId             = itemId;
     this.propertyBagFactory = propertyBagFactory;
     this.openChangeKey      = openChangeKey;
     if (propertyBag.DisposeTracker != null)
     {
         propertyBag.DisposeTracker.AddExtraDataWithStackTrace("AcrPropertyBag owns PersistablePropertyBag propertyBag at");
     }
 }
Beispiel #8
0
        private static AcrProfile CreateMasterCategoryListProfile()
        {
            AcrProfile acrProfile = AcrProfile.CreateWithGenericResolver(new AcrPropertyResolverChain(new AcrPropertyResolverChain.ResolutionFunction[]
            {
                new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToModifiedValue),
                new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToGreatestDependency <ExDateTime>)
            }, new PropertyDefinition[]
            {
                MasterCategoryListSchema.LastSavedTime
            }, false), new AcrProfile[0]);

            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToHighestValue <ExDateTime>), false, new StorePropertyDefinition[]
            {
                MasterCategoryListSchema.LastSavedTime
            });
            return(acrProfile);
        }
Beispiel #9
0
        private static AcrProfile CreateReminderProfile()
        {
            AcrProfile acrProfile = new AcrProfile(null, new AcrProfile[0]);

            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToOredValue), false, new StorePropertyDefinition[]
            {
                InternalSchema.ReminderIsSetInternal
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToEarlierTime), false, new StorePropertyDefinition[]
            {
                InternalSchema.ReminderDueByInternal
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToEarlierTime), false, new StorePropertyDefinition[]
            {
                InternalSchema.ReminderNextTime
            });
            return(acrProfile);
        }
Beispiel #10
0
        private static AcrProfile CreateAppointmentProfile()
        {
            AcrProfile acrProfile = new AcrProfile(null, new AcrProfile[]
            {
                AcrProfile.CommonMessageProfile,
                AcrProfile.ReminderProfile
            });

            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToHighestIntValue), false, new StorePropertyDefinition[]
            {
                InternalSchema.ReminderMinutesBeforeStartInternal
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValueIfServerValueNotModified), true, new StorePropertyDefinition[]
            {
                InternalSchema.MapiStartTime
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValueIfServerValueNotModified), true, new StorePropertyDefinition[]
            {
                InternalSchema.MapiPRStartDate
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValueIfServerValueNotModified), true, new StorePropertyDefinition[]
            {
                InternalSchema.Location
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValueIfServerValueNotModified), true, new StorePropertyDefinition[]
            {
                InternalSchema.LocationDisplayName
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValueIfServerValueNotModified), true, new StorePropertyDefinition[]
            {
                InternalSchema.LidWhere
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
            {
                InternalSchema.OutlookInternalVersion
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
            {
                InternalSchema.OutlookVersion
            });
            AcrProfile.AddCalendarLoggingPropertyProfile(acrProfile);
            return(acrProfile);
        }
Beispiel #11
0
        private static AcrProfile CreateCategoryProfile()
        {
            AcrProfile acrProfile = AcrProfile.CreateWithGenericResolver(new AcrPropertyResolverChain(new AcrPropertyResolverChain.ResolutionFunction[]
            {
                new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToModifiedValue),
                new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToGreatestDependency <ExDateTime>)
            }, new PropertyDefinition[]
            {
                CategorySchema.LastTimeUsed
            }, false), new AcrProfile[0]);

            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToHighestValue <ExDateTime>), false, new StorePropertyDefinition[]
            {
                CategorySchema.LastTimeUsed
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToHighestValue <ExDateTime>), false, new StorePropertyDefinition[]
            {
                CategorySchema.LastTimeUsedCalendar
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToHighestValue <ExDateTime>), false, new StorePropertyDefinition[]
            {
                CategorySchema.LastTimeUsedContacts
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToHighestValue <ExDateTime>), false, new StorePropertyDefinition[]
            {
                CategorySchema.LastTimeUsedJournal
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToHighestValue <ExDateTime>), false, new StorePropertyDefinition[]
            {
                CategorySchema.LastTimeUsedMail
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToHighestValue <ExDateTime>), false, new StorePropertyDefinition[]
            {
                CategorySchema.LastTimeUsedNotes
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToHighestValue <ExDateTime>), false, new StorePropertyDefinition[]
            {
                CategorySchema.LastTimeUsedTasks
            });
            return(acrProfile);
        }
Beispiel #12
0
        private static AcrProfile CreateMeetingMessageProfile()
        {
            AcrProfile acrProfile = new AcrProfile(null, new AcrProfile[]
            {
                AcrProfile.CommonMessageProfile
            });

            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToOredValue), false, new StorePropertyDefinition[]
            {
                InternalSchema.IsProcessed
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveResponseType), false, new StorePropertyDefinition[]
            {
                InternalSchema.MapiResponseType
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
            {
                InternalSchema.OutlookInternalVersion
            });
            AcrProfile.AddCalendarLoggingPropertyProfile(acrProfile);
            return(acrProfile);
        }
Beispiel #13
0
        private static AcrProfile CreateReplyForwardRelatedProfile()
        {
            AcrProfile acrProfile = new AcrProfile(null, new AcrProfile[0]);

            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
            {
                InternalSchema.IconIndex
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
            {
                InternalSchema.LastVerbExecuted
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
            {
                InternalSchema.LastVerbExecutionTime
            });
            acrProfile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
            {
                InternalSchema.Flags
            });
            return(acrProfile);
        }
Beispiel #14
0
        internal static PersistablePropertyBag ConstructItemPersistablePropertyBag(StoreSession session, ICollection <PropertyDefinition> propertiesToLoad, bool createAcrPropertyBag, AcrProfile acrProfile, ItemBuilder.MapiMessageCreator mapiMessageCreator)
        {
            MapiMessage            mapiMessage             = null;
            PersistablePropertyBag persistablePropertyBag  = null;
            PersistablePropertyBag persistablePropertyBag2 = null;
            bool flag = false;
            PersistablePropertyBag result;

            try
            {
                mapiMessage            = mapiMessageCreator();
                persistablePropertyBag = new StoreObjectPropertyBag(session, mapiMessage, propertiesToLoad);
                PersistablePropertyBag persistablePropertyBag3;
                if (createAcrPropertyBag)
                {
                    persistablePropertyBag2 = new AcrPropertyBag(persistablePropertyBag, acrProfile, null, new RetryBagFactory(session), null);
                    persistablePropertyBag3 = persistablePropertyBag2;
                }
                else
                {
                    persistablePropertyBag3 = persistablePropertyBag;
                }
                flag   = true;
                result = persistablePropertyBag3;
            }
            finally
            {
                if (!flag)
                {
                    Util.DisposeIfPresent(persistablePropertyBag2);
                    Util.DisposeIfPresent(persistablePropertyBag);
                    Util.DisposeIfPresent(mapiMessage);
                }
            }
            return(result);
        }
        private static Dictionary <PropertyDefinition, AcrPropertyProfile.ValuesToResolve> GetPropValuesToResolve(MemoryPropertyBag client, MemoryPropertyBag server, MemoryPropertyBag original, AcrProfile profile)
        {
            Dictionary <PropertyDefinition, AcrPropertyProfile.ValuesToResolve> dictionary = new Dictionary <PropertyDefinition, AcrPropertyProfile.ValuesToResolve>();
            HashSet <PropertyDefinition> propertiesNeededForResolution = profile.GetPropertiesNeededForResolution(Util.CompositeEnumerator <PropertyDefinition>(new IEnumerable <PropertyDefinition>[]
            {
                client.Keys,
                server.Keys
            }));

            foreach (PropertyDefinition propertyDefinition in propertiesNeededForResolution)
            {
                dictionary.Add(propertyDefinition, new AcrPropertyProfile.ValuesToResolve(client.TryGetProperty(propertyDefinition), server.TryGetProperty(propertyDefinition), (original != null) ? original.TryGetProperty(propertyDefinition) : null));
            }
            return(dictionary);
        }
        internal static IEnumerable <PropValue> ResolveProperties(MemoryPropertyBag client, MemoryPropertyBag server, MemoryPropertyBag original, AcrProfile profile)
        {
            ConflictResolutionResult resolutionResult = profile.ResolveConflicts(MasterCategoryList.GetPropValuesToResolve(client, server, original, profile));

            if (resolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
            {
                throw new Exception();
            }
            foreach (PropertyConflict conflict in resolutionResult.PropertyConflicts)
            {
                yield return(new PropValue(InternalSchema.ToStorePropertyDefinition(conflict.PropertyDefinition), conflict.ResolvedValue));
            }
            yield break;
        }
Beispiel #17
0
 private static void AddCalendarLoggingPropertyProfile(AcrProfile profile)
 {
     profile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
     {
         InternalSchema.ItemVersion
     });
     profile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
     {
         InternalSchema.ChangeList
     });
     profile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
     {
         InternalSchema.CalendarLogTriggerAction
     });
     profile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
     {
         InternalSchema.OriginalFolderId
     });
     profile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
     {
         InternalSchema.OriginalCreationTime
     });
     profile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
     {
         InternalSchema.OriginalLastModifiedTime
     });
     profile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
     {
         InternalSchema.OriginalEntryId
     });
     profile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
     {
         InternalSchema.ClientInfoString
     });
     profile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
     {
         InternalSchema.ClientProcessName
     });
     profile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
     {
         InternalSchema.ClientMachineName
     });
     profile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
     {
         InternalSchema.ClientBuildVersion
     });
     profile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
     {
         InternalSchema.MiddleTierProcessName
     });
     profile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
     {
         InternalSchema.MiddleTierServerName
     });
     profile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
     {
         InternalSchema.MiddleTierServerBuildVersion
     });
     profile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
     {
         InternalSchema.MailboxServerName
     });
     profile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
     {
         InternalSchema.MailboxServerBuildVersion
     });
     profile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
     {
         InternalSchema.MailboxDatabaseName
     });
     profile.AddPropertyProfile(new AcrPropertyResolverChain.ResolutionFunction(AcrHelpers.ResolveToClientValue), false, new StorePropertyDefinition[]
     {
         InternalSchema.ResponsibleUserName
     });
 }