コード例 #1
0
        public ConflictResolutionResult Save(SaveMode saveMode)
        {
            this.CheckDisposed("Save");
            ExTraceGlobals.StorageTracer.Information((long)this.GetHashCode(), "UserConfiguration::Save.");
            if (!this.isOpenMode)
            {
                this.Item[InternalSchema.ItemClass]             = this.configName.FullName;
                this.Item[InternalSchema.UserConfigurationType] = (int)this.configType;
            }
            this.Item.OpenAsReadWrite();
            if (this.configDictionary != null && this.configDictionary.IsDirty)
            {
                using (Stream stream = this.Item.OpenPropertyStream(InternalSchema.UserConfigurationDictionary, PropertyOpenMode.Create))
                {
                    using (XmlWriter xmlWriter = UserConfiguration.InternalGetXmlWriter(stream))
                    {
                        this.configDictionary.WriteXml(xmlWriter);
                    }
                }
            }
            ConflictResolutionResult conflictResolutionResult = this.Item.Save(saveMode);

            if (conflictResolutionResult.SaveStatus == SaveResult.Success || conflictResolutionResult.SaveStatus == SaveResult.SuccessWithConflictResolution)
            {
                if (!this.isOpenMode)
                {
                    this.id = this.Item.StoreObjectId;
                    this.ConflictDetection();
                }
                this.isOpenMode = true;
            }
            return(conflictResolutionResult);
        }
コード例 #2
0
        private static IPushNotificationSubscriptionItem Create(IMailboxSession session, IXSOFactory xsoFactory, StoreId locationFolderId, string subscriptionId, PushNotificationServerSubscription subscription)
        {
            IPushNotificationSubscriptionItem pushNotificationSubscriptionItem = null;

            try
            {
                pushNotificationSubscriptionItem                = xsoFactory.CreatePushNotificationSubscriptionItem(session, locationFolderId);
                subscription.LastSubscriptionUpdate             = (DateTime)pushNotificationSubscriptionItem.LastUpdateTimeUTC;
                pushNotificationSubscriptionItem.SubscriptionId = subscriptionId;
                pushNotificationSubscriptionItem.SerializedNotificationSubscription = subscription.ToJson();
                if (ExTraceGlobals.StorageNotificationSubscriptionTracer.IsTraceEnabled(TraceType.DebugTrace))
                {
                    ExTraceGlobals.StorageNotificationSubscriptionTracer.TraceDebug <string, ExDateTime, string>((long)subscription.GetHashCode(), "PushNotificationSubscriptionItem.Create: Created SubscriptionItem on store, Id:{0}, RefTm:{1}, Json:{2}", pushNotificationSubscriptionItem.SubscriptionId, pushNotificationSubscriptionItem.LastUpdateTimeUTC, pushNotificationSubscriptionItem.SerializedNotificationSubscription);
                }
                ConflictResolutionResult conflictResolutionResult = pushNotificationSubscriptionItem.Save(SaveMode.FailOnAnyConflict);
                if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
                {
                    ExTraceGlobals.StorageNotificationSubscriptionTracer.TraceError <string>((long)pushNotificationSubscriptionItem.GetHashCode(), "PushNotificationSubscriptionItem.Create: Save failed due to conflicts for subscription {0}.", subscriptionId);
                    throw new SaveConflictException(ServerStrings.ExSaveFailedBecauseOfConflicts(pushNotificationSubscriptionItem.SubscriptionId));
                }
                pushNotificationSubscriptionItem.Load(SubscriptionItemEnumeratorBase.PushNotificationSubscriptionItemProperties);
            }
            catch
            {
                if (pushNotificationSubscriptionItem != null)
                {
                    pushNotificationSubscriptionItem.Dispose();
                }
                throw;
            }
            return(pushNotificationSubscriptionItem);
        }
コード例 #3
0
        private static CalendarGroup CreateMyCalendarsGroup(MailboxSession session)
        {
            CalendarGroup calendarGroup = null;

            using (DisposeGuard disposeGuard = default(DisposeGuard))
            {
                calendarGroup = CalendarGroup.InternalCreateGroup(session, CalendarGroupType.MyCalendars);
                disposeGuard.Add <CalendarGroup>(calendarGroup);
                using (CalendarGroupEntry calendarGroupEntry = CalendarGroupEntry.Create(session, session.GetDefaultFolderId(DefaultFolderType.Calendar), FolderTreeData.MyFoldersClassId, calendarGroup.GroupName))
                {
                    calendarGroupEntry.CalendarName = ClientStrings.Calendar.ToString(session.InternalCulture);
                    ConflictResolutionResult conflictResolutionResult = calendarGroupEntry.Save(SaveMode.NoConflictResolution);
                    if (conflictResolutionResult.SaveStatus != SaveResult.Success)
                    {
                        ExTraceGlobals.StorageTracer.TraceWarning <SmtpAddress>(0L, "Unable to associate default calendar with the MyCalendars group for user: {0}. Attempting to delete default calendars group.", session.MailboxOwner.MailboxInfo.PrimarySmtpAddress);
                        AggregateOperationResult aggregateOperationResult = session.Delete(DeleteItemFlags.HardDelete, new StoreId[]
                        {
                            calendarGroup.Id
                        });
                        if (aggregateOperationResult.OperationResult != OperationResult.Succeeded)
                        {
                            ExTraceGlobals.StorageTracer.TraceWarning <SmtpAddress>(0L, "Unable to delete default calendar group after failing to add the default calendar to it. User: {0}", session.MailboxOwner.MailboxInfo.PrimarySmtpAddress);
                        }
                        throw new DefaultCalendarNodeCreationException();
                    }
                }
                disposeGuard.Success();
            }
            return(calendarGroup);
        }
コード例 #4
0
        private void PostResponded(SharingResponseType responseType)
        {
            if (!this.SharingMessageType.IsRequest)
            {
                throw new InvalidOperationException("Only can response to a request message.");
            }
            base.OpenAsReadWrite();
            this.SharingResponseType = responseType;
            this.SharingResponseTime = new ExDateTime?(ExDateTime.Now);
            ConflictResolutionResult conflictResolutionResult = base.Save(SaveMode.ResolveConflicts);

            if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
            {
                ExTraceGlobals.SharingTracer.TraceError <IExchangePrincipal, VersionedId>((long)this.GetHashCode(), "{0}: Conflict occurred when saving response-status into request message {1}", this.MailboxSession.MailboxOwner, base.Id);
            }
            if (responseType == SharingResponseType.Denied)
            {
                try
                {
                    SharingProvider targetSharingProvider = this.GetTargetSharingProvider();
                    targetSharingProvider.PerformRevocation(this.MailboxSession, this.SharingContext);
                }
                catch (StoragePermanentException arg)
                {
                    ExTraceGlobals.SharingTracer.TraceError <IExchangePrincipal, StoragePermanentException>((long)this.GetHashCode(), "{0}: Error occurred when revoking sharing from denied requester. Exception = {1}", this.MailboxSession.MailboxOwner, arg);
                }
            }
        }
コード例 #5
0
        internal ConflictResolutionResult FlushChangesWithAcr(SaveMode saveMode)
        {
            base.CheckDisposed("AcrPropertyBag::FlushChangesWithAcr");
            ConflictResolutionResult conflictResolutionResult = null;

            if (this.CanSaveBeNoOp())
            {
                return(ConflictResolutionResult.Success);
            }
            switch (this.Mode)
            {
            case AcrPropertyBag.AcrMode.ReadOnly:
                throw new AccessDeniedException(ServerStrings.ExItemIsOpenedInReadOnlyMode);

            case AcrPropertyBag.AcrMode.Active:
                conflictResolutionResult = this.ApplyAcr(this.propertyBag, saveMode);
                if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
                {
                    return(conflictResolutionResult);
                }
                break;
            }
            this.propertyBag.FlushChanges();
            this.uncommitted = true;
            if (conflictResolutionResult == null)
            {
                conflictResolutionResult = ConflictResolutionResult.Success;
            }
            return(conflictResolutionResult);
        }
コード例 #6
0
 protected override void OnAfterSave(ConflictResolutionResult acrResults)
 {
     base.OnAfterSave(acrResults);
     if (!base.IsInMemoryObject)
     {
         base.CoreItem.DisposeAttachmentCollection();
     }
 }
コード例 #7
0
 protected override void OnAfterSave(ConflictResolutionResult acrResults)
 {
     base.OnAfterSave(acrResults);
     if (acrResults.SaveStatus != SaveResult.IrresolvableConflict)
     {
         this.members = null;
     }
 }
コード例 #8
0
 protected override void OnAfterSave(ConflictResolutionResult acrResults)
 {
     base.OnAfterSave(acrResults);
     if (acrResults.SaveStatus != SaveResult.IrresolvableConflict)
     {
         this.areEmailAddressesLoaded = false;
         this.UpdateJunkEmailContacts();
     }
 }
コード例 #9
0
        internal static void UpdateOriginalItemProperties(Item sentItem)
        {
            object[] array = ReplyForwardUtils.DecodeReplyForwardStatus(sentItem.TryGetProperty(InternalSchema.ReplyForwardStatus) as string);
            if (array == null)
            {
                return;
            }
            if ((int)array[0] < 0)
            {
                return;
            }
            PropertyDefinition[] array2 = new PropertyDefinition[]
            {
                InternalSchema.LastVerbExecuted,
                InternalSchema.LastVerbExecutionTime,
                InternalSchema.IconIndex,
                InternalSchema.MessageAnswered
            };
            object[]    array3  = new object[array2.Length];
            VersionedId storeId = VersionedId.Deserialize((string)array[2]);

            try
            {
                using (Item item = Item.Bind(sentItem.Session, storeId))
                {
                    if (!(item is CalendarItemBase))
                    {
                        array3[0] = (int)array[0];
                        array3[1] = ExDateTime.GetNow(sentItem.Session.ExTimeZone);
                        if (item is MeetingMessage)
                        {
                            array3[2] = item.GetValueOrDefault <int>(InternalSchema.IconIndex, -1);
                        }
                        else
                        {
                            array3[2] = (int)array[1];
                        }
                        array3[3] = true;
                        item.SetProperties(array2, array3);
                        ConflictResolutionResult conflictResolutionResult = item.Save(SaveMode.ResolveConflicts);
                        if (conflictResolutionResult.SaveStatus != SaveResult.Success)
                        {
                            ExTraceGlobals.StorageTracer.TraceDebug <string>(0L, "ReplyForwardCommon::UpdateOriginalItemProperties. {0}", "The original item has been changed thus update on the original item may not be done accurately.");
                        }
                    }
                }
            }
            catch (StoragePermanentException arg)
            {
                ExTraceGlobals.StorageTracer.TraceDebug <StoragePermanentException>(0L, "ReplyForwardCommon::UpdateOriginalItemProperties. The parent item cannot be found. It might have been deleted. Exception = {0}.", arg);
            }
            catch (StorageTransientException arg2)
            {
                ExTraceGlobals.StorageTracer.TraceDebug <StorageTransientException>(0L, "ReplyForwardCommon::UpdateOriginalItemProperties. The parent item cannot be found. It might have been deleted. Exception = {0}.", arg2);
            }
        }
コード例 #10
0
        public static IPushNotificationSubscriptionItem CreateOrUpdateSubscription(IMailboxSession session, IXSOFactory xsoFactory, IFolder folder, string subscriptionId, PushNotificationServerSubscription subscription)
        {
            Util.ThrowOnNullArgument(session, "session");
            Util.ThrowOnNullArgument(xsoFactory, "xsoFactory");
            Util.ThrowOnNullArgument(folder, "folder");
            Util.ThrowOnNullOrEmptyArgument(subscriptionId, "subscriptionId");
            Util.ThrowOnNullArgument(subscription, "subscription");
            ExTraceGlobals.StorageNotificationSubscriptionTracer.TraceDebug <string, IExchangePrincipal>((long)subscription.GetHashCode(), "PushNotificationSubscriptionItem.CreateOrUpdateSubscription: Searching for Subscription {0} on Mailbox {1}.", subscriptionId, session.MailboxOwner);
            IStorePropertyBag[] array = PushNotificationSubscriptionItem.GetSubscriptionById(folder, subscriptionId).ToArray <IStorePropertyBag>();
            IPushNotificationSubscriptionItem pushNotificationSubscriptionItem = null;

            try
            {
                if (array.Length >= 1)
                {
                    if (array.Length > 1)
                    {
                        ExTraceGlobals.StorageNotificationSubscriptionTracer.TraceWarning <string, Guid>(0L, "PushNotificationSubscriptionItem.CreateOrUpdateSubscription: AmbiguousSubscription for subscription {0} and user {1}", subscriptionId, session.MailboxGuid);
                    }
                    IStorePropertyBag storePropertyBag = array[0];
                    VersionedId       valueOrDefault   = storePropertyBag.GetValueOrDefault <VersionedId>(ItemSchema.Id, null);
                    if (valueOrDefault == null)
                    {
                        ExTraceGlobals.StorageNotificationSubscriptionTracer.TraceError <string>((long)storePropertyBag.GetHashCode(), "PushNotificationSubscriptionItem.CreateOrUpdateSubscription: Cannot resolve the ItemSchema.Id property from the Enumerable.", subscriptionId);
                        throw new CannotResolvePropertyException(ItemSchema.Id.Name);
                    }
                    ExTraceGlobals.StorageNotificationSubscriptionTracer.TraceDebug <VersionedId>((long)storePropertyBag.GetHashCode(), "PushNotificationSubscriptionItem.CreateOrUpdateSubscription: Found one existing subscription with ItemSchema.Id = {0}.", valueOrDefault);
                    pushNotificationSubscriptionItem = xsoFactory.BindToPushNotificationSubscriptionItem(session, valueOrDefault, null);
                    pushNotificationSubscriptionItem.LastUpdateTimeUTC = ExDateTime.UtcNow;
                    subscription.LastSubscriptionUpdate = (DateTime)pushNotificationSubscriptionItem.LastUpdateTimeUTC;
                    pushNotificationSubscriptionItem.SerializedNotificationSubscription = subscription.ToJson();
                    ConflictResolutionResult conflictResolutionResult = pushNotificationSubscriptionItem.Save(SaveMode.ResolveConflicts);
                    if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
                    {
                        ExTraceGlobals.StorageNotificationSubscriptionTracer.TraceError <string>((long)storePropertyBag.GetHashCode(), "PushNotificationSubscriptionItem.CreateOrUpdateSubscription: Save failed due to conflicts for subscription {0}.", subscriptionId);
                        throw new SaveConflictException(ServerStrings.ExSaveFailedBecauseOfConflicts(subscriptionId));
                    }
                    pushNotificationSubscriptionItem.Load(SubscriptionItemEnumeratorBase.PushNotificationSubscriptionItemProperties);
                }
                else
                {
                    ExTraceGlobals.StorageNotificationSubscriptionTracer.TraceDebug((long)subscription.GetHashCode(), "PushNotificationSubscriptionItem.CreateOrUpdateSubscription: Cannot resolve given subscription, about to create a new SubscriptionItem.");
                    pushNotificationSubscriptionItem = PushNotificationSubscriptionItem.Create(session, xsoFactory, folder.StoreObjectId, subscriptionId, subscription);
                }
            }
            catch
            {
                if (pushNotificationSubscriptionItem != null)
                {
                    pushNotificationSubscriptionItem.Dispose();
                }
                throw;
            }
            return(pushNotificationSubscriptionItem);
        }
コード例 #11
0
        private void SaveSubscribeTime()
        {
            base.OpenAsReadWrite();
            this.SharingLastSubscribeTime = new ExDateTime?(ExDateTime.Now);
            ConflictResolutionResult conflictResolutionResult = base.Save(SaveMode.ResolveConflicts);

            if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
            {
                ExTraceGlobals.SharingTracer.TraceError <IExchangePrincipal>((long)this.GetHashCode(), "{0}: Conflict occurred when saving last-subscribe-time.", this.MailboxSession.MailboxOwner);
            }
        }
コード例 #12
0
 private void RefreshCacheAfterSave(ConflictResolutionResult resolutionResults)
 {
     if (this.Mode != AcrPropertyBag.AcrMode.NewItem)
     {
         this.propertyTrackingCache.Clear();
     }
     this.currentChangeKey = (this.openChangeKey = Guid.NewGuid().ToByteArray());
     this.acrModeHint      = AcrPropertyBag.AcrMode.Passive;
     this.propertiesWrittenAsStream.Clear();
     this.irresolvableChanges = false;
 }
コード例 #13
0
        private void SaveSubscriptionData(Item item, TData subscriptionData)
        {
            this.StampItemFromDataObject(item, subscriptionData);
            ConflictResolutionResult conflictResolutionResult = item.Save(SaveMode.ResolveConflicts);

            if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
            {
                ExTraceGlobals.SharingTracer.TraceDebug <IExchangePrincipal, TData>((long)this.GetHashCode(), "{0}: A race condition occurred when saving subscription {1}", this.mailboxSession.MailboxOwner, subscriptionData);
                throw new SharingConflictException(conflictResolutionResult);
            }
            ExTraceGlobals.SharingTracer.TraceDebug <IExchangePrincipal, TData>((long)this.GetHashCode(), "{0}: saved subscription {1}", this.mailboxSession.MailboxOwner, subscriptionData);
        }
コード例 #14
0
        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;
        }
コード例 #15
0
        internal ConflictResolutionResult SaveChangesWithAcr(SaveMode saveMode)
        {
            base.CheckDisposed("AcrPropertyBag::SaveChangesWithAcr");
            ConflictResolutionResult conflictResolutionResult = null;

            if (this.CanSaveBeNoOp() && !this.uncommitted)
            {
                return(ConflictResolutionResult.Success);
            }
            try
            {
                this.propertyBag.SaveChanges(false);
                this.uncommitted = false;
            }
            catch (SaveConflictException)
            {
                PersistablePropertyBag persistablePropertyBag = this.propertyBagFactory.CreateStorePropertyBag(this.propertyBag, this.PrefetchPropertyArray);
                persistablePropertyBag.Context.Copy(this.propertyBag.Context);
                try
                {
                    conflictResolutionResult = this.ApplyAcr(persistablePropertyBag, saveMode);
                    if (conflictResolutionResult.SaveStatus == SaveResult.Success || conflictResolutionResult.SaveStatus == SaveResult.SuccessWithConflictResolution)
                    {
                        persistablePropertyBag.FlushChanges();
                        persistablePropertyBag.SaveChanges(false);
                        this.PropertyBag       = persistablePropertyBag;
                        persistablePropertyBag = null;
                        this.uncommitted       = false;
                    }
                }
                finally
                {
                    if (persistablePropertyBag != null)
                    {
                        persistablePropertyBag.Dispose();
                    }
                }
            }
            if (conflictResolutionResult == null)
            {
                conflictResolutionResult = ConflictResolutionResult.Success;
            }
            if (conflictResolutionResult.SaveStatus != SaveResult.IrresolvableConflict)
            {
                this.RefreshCacheAfterSave(conflictResolutionResult);
            }
            return(conflictResolutionResult);
        }
コード例 #16
0
        private static bool AddDefaultTaskFolder(MailboxSession session, TaskGroup taskGroup, DefaultFolderType folderType, string folderName)
        {
            bool result = true;

            using (TaskGroupEntry taskGroupEntry = TaskGroupEntry.Create(session, session.GetDefaultFolderId(folderType), FolderTreeData.MyFoldersClassId, taskGroup.GroupName))
            {
                taskGroupEntry.FolderName = folderName;
                ConflictResolutionResult conflictResolutionResult = taskGroupEntry.Save(SaveMode.NoConflictResolution);
                if (conflictResolutionResult.SaveStatus != SaveResult.Success)
                {
                    ExTraceGlobals.StorageTracer.TraceWarning <DefaultFolderType, SmtpAddress>(0L, "Unable to associate default task folder type: {0} with the MyTasks group for user: {1}. Attempting to delete default tasks group.", folderType, session.MailboxOwner.MailboxInfo.PrimarySmtpAddress);
                    result = false;
                }
            }
            return(result);
        }
コード例 #17
0
 private void SaveItem(ICoreItem item, StoreSession session, COWTriggerAction operation)
 {
     item.SetEnableFullValidation(false);
     try
     {
         ConflictResolutionResult conflictResolutionResult = item.Save(SaveMode.FailOnAnyConflict);
         if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
         {
             ExTraceGlobals.CalendarLoggingTracer.TraceWarning <int, ICoreItem, COWTriggerAction>((long)session.GetHashCode(), "Save Item for Calendar Logging failure ({0} conflicts, item {1}, operation {2}).", (conflictResolutionResult.PropertyConflicts == null) ? 0 : conflictResolutionResult.PropertyConflicts.Length, item, operation);
         }
     }
     catch (QuotaExceededException arg)
     {
         ExTraceGlobals.CalendarLoggingTracer.TraceWarning <QuotaExceededException, ICoreItem, COWTriggerAction>((long)session.GetHashCode(), "Save Item for Calendar Logging failure due to exceeded quota (exception {0}, item {1}, operation {2}).", arg, item, operation);
     }
 }
コード例 #18
0
        private static CalendarGroup InternalCreateGroup(MailboxSession session, CalendarGroupType groupType)
        {
            CalendarGroup calendarGroup;

            using (DisposeGuard disposeGuard = default(DisposeGuard))
            {
                calendarGroup = CalendarGroup.CreateDefaultGroup(groupType, session);
                disposeGuard.Add <CalendarGroup>(calendarGroup);
                ConflictResolutionResult conflictResolutionResult = calendarGroup.Save(SaveMode.NoConflictResolution);
                if (conflictResolutionResult.SaveStatus != SaveResult.Success)
                {
                    ExTraceGlobals.StorageTracer.TraceWarning <CalendarGroupType, SmtpAddress>(0L, "Unable to create group of type {0} for user: {1}", groupType, session.MailboxOwner.MailboxInfo.PrimarySmtpAddress);
                    throw new DefaultCalendarGroupCreationException(groupType.ToString());
                }
                calendarGroup.Load();
                disposeGuard.Success();
            }
            return(calendarGroup);
        }
コード例 #19
0
        private static TaskGroup InternalCreateDefaultGroup(MailboxSession session)
        {
            TaskGroup taskGroup;

            using (DisposeGuard disposeGuard = default(DisposeGuard))
            {
                taskGroup              = TaskGroup.Create(session);
                taskGroup.GroupName    = ClientStrings.MyTasks.ToString(session.InternalCulture);
                taskGroup.GroupClassId = FolderTreeData.MyFoldersClassId;
                disposeGuard.Add <TaskGroup>(taskGroup);
                ConflictResolutionResult conflictResolutionResult = taskGroup.Save(SaveMode.NoConflictResolution);
                if (conflictResolutionResult.SaveStatus != SaveResult.Success)
                {
                    ExTraceGlobals.StorageTracer.TraceWarning <SmtpAddress>(0L, "Unable to create default group for user: {0}", session.MailboxOwner.MailboxInfo.PrimarySmtpAddress);
                    throw new DefaultTaskGroupCreationException();
                }
                taskGroup.Load();
                disposeGuard.Success();
            }
            return(taskGroup);
        }
コード例 #20
0
        public SaveResult Save()
        {
            this.CheckDisposed("Save");
            if (!this.isDirty)
            {
                bool flag = false;
                foreach (ExternalUser externalUser in this.data)
                {
                    flag |= externalUser.PropertyBag.IsDirty;
                }
                if (!flag)
                {
                    return(SaveResult.Success);
                }
            }
            using (Stream stream = this.directoryMessage.OpenPropertyStream(InternalSchema.LocalDirectory, PropertyOpenMode.Create))
            {
                using (BinaryWriter binaryWriter = new BinaryWriter(stream))
                {
                    foreach (ExternalUser externalUser2 in this.data)
                    {
                        binaryWriter.Write(ExternalUserCollection.ptagLocalDirectoryEntryId);
                        ICollection <PropertyDefinition> allFoundProperties = externalUser2.PropertyBag.AllFoundProperties;
                        binaryWriter.Write((uint)allFoundProperties.Count);
                        ExternalUserCollection.WritePropValue(binaryWriter, InternalSchema.MemberSIDLocalDirectory, externalUser2.PropertyBag);
                        foreach (PropertyDefinition propertyDefinition in allFoundProperties)
                        {
                            if (propertyDefinition != InternalSchema.MemberSIDLocalDirectory)
                            {
                                ExternalUserCollection.WritePropValue(binaryWriter, propertyDefinition, externalUser2.PropertyBag);
                            }
                        }
                    }
                }
            }
            ConflictResolutionResult conflictResolutionResult = this.directoryMessage.Save(SaveMode.ResolveConflicts);

            return(conflictResolutionResult.SaveStatus);
        }
コード例 #21
0
 protected internal bool HasAcrAffectedReminders(ConflictResolutionResult acrResults)
 {
     PropertyDefinition[] array = new PropertyDefinition[]
     {
         InternalSchema.ReminderIsSetInternal,
         InternalSchema.ReminderDueByInternal,
         InternalSchema.ReminderNextTime
     };
     if (acrResults.SaveStatus == SaveResult.SuccessWithConflictResolution)
     {
         foreach (PropertyConflict propertyConflict in acrResults.PropertyConflicts)
         {
             foreach (PropertyDefinition obj in array)
             {
                 if (propertyConflict.PropertyDefinition.Equals(obj))
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
コード例 #22
0
        private MeetingInquiryAction TryReviveMeeting(CalendarItemBase deletedVersion)
        {
            bool flag = false;

            if (this.GlobalObjectId.IsCleanGlobalObjectId)
            {
                using (CalendarItemBase calendarItemBase = (CalendarItemBase)Microsoft.Exchange.Data.Storage.Item.CloneItem(base.Session, this.MailboxSession.GetDefaultFolderId(DefaultFolderType.Calendar), deletedVersion, false, true, null))
                {
                    calendarItemBase.LocationIdentifierHelperInstance.SetLocationIdentifier(43287U, LastChangeAction.Resurrect);
                    calendarItemBase.Save(SaveMode.NoConflictResolution);
                    flag = true;
                    goto IL_207;
                }
            }
            using (CalendarFolder calendarFolder = CalendarFolder.Bind(this.MailboxSession, DefaultFolderType.Calendar))
            {
                StoreId calendarItemId = calendarFolder.GetCalendarItemId(this.GlobalObjectId.CleanGlobalObjectIdBytes);
                if (calendarItemId != null)
                {
                    using (CalendarItem calendarItem = CalendarItem.Bind(this.MailboxSession, calendarItemId))
                    {
                        if (calendarItem.CalendarItemType == CalendarItemType.RecurringMaster)
                        {
                            try
                            {
                                calendarItem.RecoverDeletedOccurrenceByDateId(this.GlobalObjectId.Date);
                                calendarItem.LocationIdentifierHelperInstance.SetLocationIdentifier(59671U, LastChangeAction.Resurrect);
                                ConflictResolutionResult conflictResolutionResult = calendarItem.Save(SaveMode.ResolveConflicts);
                                if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
                                {
                                    ExTraceGlobals.MeetingMessageTracer.TraceError <string, GlobalObjectId>((long)this.GetHashCode(), "Storage.MeetingInquiryMessage::ReviveDeletedVersionIfNoCancellation for Mailbox {0} and GOID {1} hit a save conflict.", this.MailboxSession.DisplayName, this.GlobalObjectId);
                                    throw new SaveConflictException(ServerStrings.ExSaveFailedBecauseOfConflicts(base.InternalObjectId), conflictResolutionResult);
                                }
                                flag = true;
                            }
                            catch (OccurrenceNotFoundException)
                            {
                                ExTraceGlobals.MeetingMessageTracer.TraceError <string, GlobalObjectId, ExDateTime>((long)this.GetHashCode(), "Storage.MeetingInquiryMessage::ReviveDeletedVersionIfNoCancellation for Mailbox {0} and GOID {1}. There's no occurrence on {2}", this.MailboxSession.DisplayName, this.GlobalObjectId, this.GlobalObjectId.Date);
                            }
                            catch (ObjectValidationException ex)
                            {
                                if (ex.Errors.Count != 1 || (!(ex.Errors[0].Constraint is OrganizerPropertiesConstraint) && !(ex.Errors[0].Constraint is CalendarOriginatorIdConstraint)))
                                {
                                    throw;
                                }
                                ExTraceGlobals.MeetingMessageTracer.TraceError <string, GlobalObjectId, string>((long)this.GetHashCode(), "Storage.MeetingInquiryMessage::ReviveDeletedVersionIfNoCancellation for Mailbox {0} and GOID {1}. Object validation failed : {2}", this.MailboxSession.DisplayName, this.GlobalObjectId, ex.Message);
                            }
                        }
                        goto IL_1FB;
                    }
                }
                ExTraceGlobals.MeetingMessageTracer.TraceError <string, byte[]>((long)this.GetHashCode(), "Storage.MeetingInquiryMessage::ReviveDeletedVersionIfNoCancellation for Mailbox {0}. Couldn't find calendar item with CGOID {1}", this.MailboxSession.DisplayName, this.GlobalObjectId.CleanGlobalObjectIdBytes);
                IL_1FB :;
            }
            IL_207 :
            if (!flag)
            {
                return(MeetingInquiryAction.FailedToRevive);
            }
            return(MeetingInquiryAction.ReviveMeeting);
        }
コード例 #23
0
 public SharingConflictException(ConflictResolutionResult conflictResolutionResult) : base(ServerStrings.SharingConflictException)
 {
     this.ConflictResolutionResult = conflictResolutionResult;
 }
コード例 #24
0
        private void ImportItem(Item promotedItem)
        {
            GlobalObjectId globalObjectId = new GlobalObjectId(promotedItem);

            object[] array = this.FindItemSnapshotByGoid(globalObjectId, true);
            if (array != null)
            {
                StoreObjectId objectId = ((VersionedId)array[this.QueryIndexId]).ObjectId;
                this.RemoveItemFromDeletionList(objectId);
            }
            CalendarItemBase calendarItemBase = this.ConvertToCalendarItem(globalObjectId, promotedItem, array);

            if (calendarItemBase != null)
            {
                using (calendarItemBase)
                {
                    if (!this.IsInImportWindow(calendarItemBase))
                    {
                        ExTraceGlobals.SharingTracer.TraceDebug((long)this.GetHashCode(), "CalendarImporter::ImportItem. Item is outside of the import window. Ignoring. GOID:{0} WindowStart:{1} WindowEnd:{2}.calItem.StartTime:{2} calItem.EndTime:{3}", new object[]
                        {
                            globalObjectId,
                            this.importWindowStart,
                            this.importWindowEnd,
                            calendarItemBase.StartTime,
                            calendarItemBase.EndTime
                        });
                    }
                    else
                    {
                        this.PostProcessing(calendarItemBase);
                        if (calendarItemBase.Validate().Length != 0)
                        {
                            ExTraceGlobals.SharingTracer.TraceDebug <VersionedId>((long)this.GetHashCode(), "CalendarImporter::ImportItems. Validation error for item ID:{0}", promotedItem.Id);
                            this.results.RawErrors.Add(ServerStrings.ValidationFailureAfterPromotion(calendarItemBase.GlobalObjectId.Uid));
                        }
                        else
                        {
                            try
                            {
                                ConflictResolutionResult conflictResolutionResult = calendarItemBase.Save(SaveMode.ResolveConflicts);
                                if (conflictResolutionResult != ConflictResolutionResult.Success)
                                {
                                    ExTraceGlobals.SharingTracer.TraceDebug <VersionedId>((long)this.GetHashCode(), "CalendarImporter::ImportItems. Failed to save item for ID:{0}", calendarItemBase.Id);
                                    this.results.RawErrors.Add(ServerStrings.SaveFailureAfterPromotion(calendarItemBase.GlobalObjectId.Uid));
                                }
                                else
                                {
                                    ExTraceGlobals.SharingTracer.TraceDebug <GlobalObjectId>((long)this.GetHashCode(), "CalendarImporter::ImportItem. Saved item. GOID:{0}.", globalObjectId);
                                    this.results.Increment(true);
                                    VersionedId calendarItemId = this.folder.GetCalendarItemId(globalObjectId.Bytes);
                                    if (calendarItemId != null)
                                    {
                                        this.UpdateItemSnapshots(globalObjectId, calendarItemId, promotedItem);
                                    }
                                }
                            }
                            catch (OccurrenceCrossingBoundaryException arg)
                            {
                                ExTraceGlobals.SharingTracer.TraceDebug <VersionedId, OccurrenceCrossingBoundaryException>((long)this.GetHashCode(), "CalendarImporter::ImportItems. Failed to save item for ID:{0}, Exception = {1}", calendarItemBase.Id, arg);
                                this.results.RawErrors.Add(ServerStrings.SaveFailureAfterPromotion(calendarItemBase.GlobalObjectId.Uid));
                            }
                            catch (CorruptDataException arg2)
                            {
                                ExTraceGlobals.SharingTracer.TraceDebug <VersionedId, CorruptDataException>((long)this.GetHashCode(), "CalendarImporter::ImportItems. Got a corrupt data exception during Save for item for ID:{0}, Exception = {1}", calendarItemBase.Id, arg2);
                                this.results.RawErrors.Add(ServerStrings.SaveFailureAfterPromotion(calendarItemBase.GlobalObjectId.Uid));
                            }
                            catch (VirusException arg3)
                            {
                                ExTraceGlobals.SharingTracer.TraceDebug <VersionedId, VirusException>((long)this.GetHashCode(), "CalendarImporter::ImportItems. Got a virus detected exception during Save for item for ID:{0}, Exception = {1}", calendarItemBase.Id, arg3);
                                this.results.RawErrors.Add(ServerStrings.SaveFailureAfterPromotion(calendarItemBase.GlobalObjectId.Uid));
                            }
                            catch (RecurrenceException arg4)
                            {
                                ExTraceGlobals.SharingTracer.TraceDebug <VersionedId, RecurrenceException>((long)this.GetHashCode(), "CalendarImporter::ImportItems. Got a recurrence exception during Save for item for ID:{0}, Exception = {1}", calendarItemBase.Id, arg4);
                                this.results.RawErrors.Add(ServerStrings.SaveFailureAfterPromotion(calendarItemBase.GlobalObjectId.Uid));
                            }
                        }
                    }
                    return;
                }
            }
            ExTraceGlobals.SharingTracer.TraceDebug <GlobalObjectId>((long)this.GetHashCode(), "CalendarImporter::ImportItem. No changes detected on input item. GOID:{0}.", globalObjectId);
            this.results.Increment(false);
        }
コード例 #25
0
        private ConflictResolutionResult ApplyAcr(PropertyBag acrPropBag, SaveMode saveMode)
        {
            Dictionary <PropertyDefinition, AcrPropertyProfile.ValuesToResolve> valuesToResolve = this.GetValuesToResolve(acrPropBag);
            string valueOrDefault = this.PropertyBag.GetValueOrDefault <string>(InternalSchema.ItemClass, string.Empty);

            if (ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(valueOrDefault) || ObjectClass.IsMeetingMessage(valueOrDefault))
            {
                LocationIdentifierHelper           locationIdentifierHelper = new LocationIdentifierHelper();
                AcrPropertyProfile.ValuesToResolve valuesToResolve2;
                object serverValue;
                if (valuesToResolve.TryGetValue(InternalSchema.ChangeList, out valuesToResolve2))
                {
                    locationIdentifierHelper.ChangeBuffer = (byte[])valuesToResolve2.ClientValue;
                    serverValue = valuesToResolve2.ServerValue;
                }
                else
                {
                    serverValue = new PropertyError(InternalSchema.ChangeList, PropertyErrorCode.NotFound);
                }
                locationIdentifierHelper.SetLocationIdentifier(53909U, LastChangeAction.AcrPerformed);
                valuesToResolve2 = new AcrPropertyProfile.ValuesToResolve(locationIdentifierHelper.ChangeBuffer, serverValue, null);
                valuesToResolve[InternalSchema.ChangeList] = valuesToResolve2;
            }
            ConflictResolutionResult conflictResolutionResult = this.profile.ResolveConflicts(valuesToResolve);

            if (this.propertiesWrittenAsStream.Count > 0)
            {
                List <PropertyConflict> list = new List <PropertyConflict>(conflictResolutionResult.PropertyConflicts);
                foreach (PropertyDefinition propertyDefinition in this.propertiesWrittenAsStream.Keys)
                {
                    PropertyConflict item = new PropertyConflict(propertyDefinition, null, null, null, null, false);
                    list.Add(item);
                }
                conflictResolutionResult = new ConflictResolutionResult(SaveResult.IrresolvableConflict, list.ToArray());
            }
            if (this.irresolvableChanges || saveMode == SaveMode.FailOnAnyConflict)
            {
                conflictResolutionResult = new ConflictResolutionResult(SaveResult.IrresolvableConflict, conflictResolutionResult.PropertyConflicts);
            }
            if (conflictResolutionResult.SaveStatus != SaveResult.IrresolvableConflict)
            {
                List <PropertyDefinition> list2 = new List <PropertyDefinition>();
                List <PropertyDefinition> list3 = new List <PropertyDefinition>();
                List <object>             list4 = new List <object>();
                if (this.propertyBag == acrPropBag)
                {
                    foreach (PropertyConflict propertyConflict in conflictResolutionResult.PropertyConflicts)
                    {
                        if (propertyConflict.ResolvedValue is PropertyError)
                        {
                            if (PropertyError.IsPropertyNotFound(propertyConflict.ResolvedValue) && (!PropertyError.IsPropertyError(propertyConflict.ClientValue) || !PropertyError.IsPropertyNotFound(propertyConflict.ClientValue)))
                            {
                                list2.Add(propertyConflict.PropertyDefinition);
                            }
                        }
                        else if (propertyConflict.ResolvedValue != propertyConflict.ClientValue)
                        {
                            list3.Add(propertyConflict.PropertyDefinition);
                            list4.Add(propertyConflict.ResolvedValue);
                        }
                    }
                }
                else
                {
                    foreach (PropertyConflict propertyConflict2 in conflictResolutionResult.PropertyConflicts)
                    {
                        if (propertyConflict2.ResolvedValue is PropertyError)
                        {
                            if (PropertyError.IsPropertyNotFound(propertyConflict2.ResolvedValue))
                            {
                                list2.Add(propertyConflict2.PropertyDefinition);
                            }
                        }
                        else if (propertyConflict2.ServerValue != propertyConflict2.ResolvedValue)
                        {
                            list3.Add(propertyConflict2.PropertyDefinition);
                            list4.Add(propertyConflict2.ResolvedValue);
                        }
                    }
                }
                for (int k = 0; k < list2.Count; k++)
                {
                    acrPropBag.Delete(list2[k]);
                }
                for (int l = 0; l < list3.Count; l++)
                {
                    acrPropBag[list3[l]] = list4[l];
                }
            }
            return(conflictResolutionResult);
        }
コード例 #26
0
ファイル: COWResults.cs プロジェクト: YHZX2013/exchange_diff
 internal COWResults(StoreSession session, ICollection <StoreObjectId> itemIds, ConflictResolutionResult conflictResolutionResult) : this(session, itemIds)
 {
     this.conflictResolutionResult = conflictResolutionResult;
 }
コード例 #27
0
        private VersionedId UpdateRetryable(MailboxSession itemStore, bool getExisting, SingleInstanceItemHandler.ContentUpdater updater)
        {
            List <object[]> list        = this.QueryItems(itemStore);
            VersionedId     versionedId = this.GetMostRecentItem(list);

            if (versionedId == null)
            {
                try
                {
                    using (Folder folder = Folder.Bind(itemStore, this.defaultFolder))
                    {
                        using (Item item = MessageItem.Create(itemStore, folder.Id))
                        {
                            item.ClassName = this.messageClass;
                            using (TextWriter textWriter = item.Body.OpenTextWriter(BodyFormat.TextPlain))
                            {
                                textWriter.Write(updater(null));
                            }
                            ConflictResolutionResult conflictResolutionResult = item.Save(SaveMode.ResolveConflicts);
                            if (conflictResolutionResult.SaveStatus == SaveResult.IrresolvableConflict)
                            {
                                throw new SaveConflictException(ServerStrings.ExSaveFailedBecauseOfConflicts(item.Id), conflictResolutionResult);
                            }
                            item.Load();
                            versionedId = item.Id;
                        }
                    }
                    SingleInstanceItemHandler.Tracer.TraceDebug <SingleInstanceItemHandler, VersionedId, IExchangePrincipal>((long)this.GetHashCode(), "{0}: Created new item itemId={1} on mailbox {2}", this, versionedId, itemStore.MailboxOwner);
                    goto IL_1CD;
                }
                catch (ObjectNotFoundException ex)
                {
                    SingleInstanceItemHandler.Tracer.TraceError <SingleInstanceItemHandler, IExchangePrincipal, ObjectNotFoundException>((long)this.GetHashCode(), "{0}: bind to folder failed on mailbox {1}. Exception={2}", this, itemStore.MailboxOwner, ex);
                    throw new SingleInstanceItemHandlerPermanentException(Strings.FailedToGetItem(this.messageClass, this.defaultFolder.ToString()), ex);
                }
            }
            using (Item item2 = MessageItem.Bind(itemStore, versionedId))
            {
                string existingContent = null;
                if (getExisting)
                {
                    using (TextReader textReader = item2.Body.OpenTextReader(BodyFormat.TextPlain))
                    {
                        existingContent = textReader.ReadToEnd();
                    }
                }
                using (TextWriter textWriter2 = item2.Body.OpenTextWriter(BodyFormat.TextPlain))
                {
                    textWriter2.Write(updater(existingContent));
                }
                ConflictResolutionResult conflictResolutionResult2 = item2.Save(SaveMode.ResolveConflicts);
                if (conflictResolutionResult2.SaveStatus == SaveResult.IrresolvableConflict)
                {
                    throw new SaveConflictException(ServerStrings.ExSaveFailedBecauseOfConflicts(item2.Id), conflictResolutionResult2);
                }
            }
            SingleInstanceItemHandler.Tracer.TraceDebug <SingleInstanceItemHandler, VersionedId, IExchangePrincipal>((long)this.GetHashCode(), "{0}: Updated item itemId={1} on mailbox {2}", this, versionedId, itemStore.MailboxOwner);
IL_1CD:
            using (IEnumerator <object[]> enumerator = list.GetEnumerator())
            {
                List <VersionedId> list2 = new List <VersionedId>();
                for (;;)
                {
                    bool flag = enumerator.MoveNext();
                    if ((!flag || list2.Count == 100) && list2.Count > 0)
                    {
                        try
                        {
                            itemStore.Delete(DeleteItemFlags.HardDelete, list2.ToArray());
                        }
                        catch (ObjectNotFoundException)
                        {
                            SingleInstanceItemHandler.Tracer.TraceError <SingleInstanceItemHandler, IExchangePrincipal>((long)this.GetHashCode(), "{0}: ObjectNotFoundException encountred while trying to delete duplicate item on mailbox {1}", this, itemStore.MailboxOwner);
                        }
                        list2.Clear();
                    }
                    if (!flag)
                    {
                        break;
                    }
                    VersionedId versionedId2 = (VersionedId)enumerator.Current[0];
                    if (versionedId != versionedId2)
                    {
                        list2.Add(versionedId2);
                        SingleInstanceItemHandler.Tracer.TraceDebug <SingleInstanceItemHandler, VersionedId, IExchangePrincipal>((long)this.GetHashCode(), "{0}: Deleting extra item {1} on mailbox {2}", this, versionedId2, itemStore.MailboxOwner);
                    }
                }
            }
            return(versionedId);
        }
コード例 #28
0
 public SaveConflictException(LocalizedString message, ConflictResolutionResult conflictResolutionResult) : base(message)
 {
     this.conflictResolutionResult = conflictResolutionResult;
 }
コード例 #29
0
 protected override void OnAfterSave(ConflictResolutionResult acrResults)
 {
     this.charsetDetectionStringForProtectedData = null;
     base.OnAfterSave(acrResults);
 }
コード例 #30
0
ファイル: ItemBuilder.cs プロジェクト: YHZX2013/exchange_diff
        internal static CoreItem CoreItemBind(StoreSession session, StoreId storeId, ItemBuilder.MapiMessageCreator mapiMessageCreator, ItemBindOption itemBindOption, ICollection <PropertyDefinition> propertiesToLoad, ref StoreObjectType storeObjectType)
        {
            Util.ThrowOnNullArgument(session, "session");
            EnumValidator.ThrowIfInvalid <ItemBindOption>(itemBindOption);
            Util.ThrowOnNullArgument(propertiesToLoad, "propertiesToLoad");
            bool     flag     = false;
            MapiProp mapiProp = null;
            PersistablePropertyBag persistablePropertyBag = null;
            AcrPropertyBag         acrPropertyBag         = null;
            CoreItem coreItem = null;
            CoreItem result2;

            using (CallbackContext callbackContext = new CallbackContext(session))
            {
                try
                {
                    session.OnBeforeItemChange(ItemChangeOperation.ItemBind, session, storeId, coreItem, callbackContext);
                    StoreObjectId storeObjectId;
                    byte[]        array;
                    StoreId.SplitStoreObjectIdAndChangeKey(storeId, out storeObjectId, out array);
                    session.CheckSystemFolderAccess(storeObjectId);
                    if (storeObjectId != null && !IdConverter.IsMessageId(storeObjectId))
                    {
                        throw new ArgumentException(ServerStrings.ExInvalidItemId);
                    }
                    bool flag2 = false;
                    OccurrenceStoreObjectId occurrenceStoreObjectId = storeObjectId as OccurrenceStoreObjectId;
                    IPropertyBagFactory     propertyBagFactory;
                    if (occurrenceStoreObjectId != null)
                    {
                        persistablePropertyBag = Item.CreateOccurrencePropertyBag(session, occurrenceStoreObjectId, propertiesToLoad);
                        storeObjectType        = StoreObjectType.CalendarItemOccurrence;
                        flag2 = true;
                        propertyBagFactory = new OccurrenceBagFactory(session, occurrenceStoreObjectId);
                    }
                    else
                    {
                        if (mapiMessageCreator != null)
                        {
                            mapiProp = mapiMessageCreator();
                        }
                        else if ((itemBindOption & ItemBindOption.SoftDeletedItem) == ItemBindOption.SoftDeletedItem)
                        {
                            mapiProp = session.GetMapiProp(storeObjectId, OpenEntryFlags.BestAccess | OpenEntryFlags.DeferredErrors | OpenEntryFlags.ShowSoftDeletes);
                        }
                        else
                        {
                            mapiProp = session.GetMapiProp(storeObjectId);
                        }
                        persistablePropertyBag = new StoreObjectPropertyBag(session, mapiProp, propertiesToLoad);
                        StoreObjectType storeObjectType2 = ItemBuilder.ReadStoreObjectTypeFromPropertyBag(persistablePropertyBag);
                        if (storeObjectType2 == storeObjectType)
                        {
                            flag2 = true;
                        }
                        else
                        {
                            storeObjectType = storeObjectType2;
                        }
                        propertyBagFactory = new RetryBagFactory(session);
                        if (storeObjectId != null && storeObjectId.ObjectType != storeObjectType)
                        {
                            storeObjectId = StoreObjectId.FromProviderSpecificId(storeObjectId.ProviderLevelItemId, storeObjectType);
                        }
                    }
                    ItemBuilder.CheckPrivateItem(session, persistablePropertyBag);
                    ItemCreateInfo itemCreateInfo = ItemCreateInfo.GetItemCreateInfo(storeObjectType);
                    if (flag2)
                    {
                        propertiesToLoad = null;
                    }
                    else
                    {
                        propertiesToLoad = ItemBuilder.GetPropertiesToLoad(itemBindOption, itemCreateInfo.Schema, propertiesToLoad);
                    }
                    acrPropertyBag = new AcrPropertyBag(persistablePropertyBag, itemCreateInfo.AcrProfile, storeObjectId, propertyBagFactory, array);
                    coreItem       = new CoreItem(session, acrPropertyBag, storeObjectId, array, Origin.Existing, ItemLevel.TopLevel, propertiesToLoad, itemBindOption);
                    flag           = true;
                    ConflictResolutionResult result = flag ? ConflictResolutionResult.Success : ConflictResolutionResult.Failure;
                    session.OnAfterItemChange(ItemChangeOperation.ItemBind, session, storeId, coreItem, result, callbackContext);
                    result2 = coreItem;
                }
                finally
                {
                    if (!flag)
                    {
                        Util.DisposeIfPresent(coreItem);
                        Util.DisposeIfPresent(acrPropertyBag);
                        Util.DisposeIfPresent(persistablePropertyBag);
                        Util.DisposeIfPresent(mapiProp);
                    }
                }
            }
            return(result2);
        }