Exemple #1
0
 internal CoreObject(StoreSession session, PersistablePropertyBag propertyBag, StoreObjectId storeObjectId, byte[] changeKey, Origin origin, ItemLevel itemLevel, ICollection <PropertyDefinition> prefetchProperties)
 {
     using (DisposeGuard disposeGuard = this.Guard())
     {
         this.session     = session;
         this.propertyBag = propertyBag;
         this.itemLevel   = itemLevel;
         this.Origin      = origin;
         if (propertyBag.DisposeTracker != null)
         {
             propertyBag.DisposeTracker.AddExtraDataWithStackTrace("CoreObject owns PersistablePropertyBag propertyBag at");
         }
         ((IDirectPropertyBag)CoreObject.GetPersistablePropertyBag(this)).Context.CoreObject = this;
         ((IDirectPropertyBag)CoreObject.GetPersistablePropertyBag(this)).Context.Session    = this.Session;
         if (prefetchProperties != null)
         {
             if (prefetchProperties == CoreObjectSchema.AllPropertiesOnStore)
             {
                 this.propertyBag.PrefetchPropertyArray = CoreObjectSchema.AllPropertiesOnStore;
             }
             else
             {
                 this.propertyBag.PrefetchPropertyArray = StorePropertyDefinition.GetNativePropertyDefinitions <PropertyDefinition>(PropertyDependencyType.AllRead, prefetchProperties).ToArray <NativeStorePropertyDefinition>();
             }
             this.propertyBag.Load(prefetchProperties);
         }
         this.storeObjectId = storeObjectId;
         this.id            = ((changeKey != null) ? new VersionedId(this.storeObjectId, changeKey) : null);
         disposeGuard.Success();
     }
 }
        public static void InitExtendedRuleSizeLimitIfNeeded(MailboxSession originalSession)
        {
            if (originalSession.LogonType != LogonType.BestAccess && originalSession.LogonType != LogonType.Delegated && originalSession.LogonType != LogonType.Owner)
            {
                return;
            }
            int?num = originalSession.Mailbox.TryGetProperty(MailboxSchema.ExtendedRuleSizeLimit) as int?;

            if (num == null || num > 522240)
            {
                using (MailboxSession mailboxSession = MailboxSession.OpenAsAdmin(originalSession.MailboxOwner, originalSession.InternalCulture, "Client=Management;Action=InitExtendedRuleSizeLimit"))
                {
                    mailboxSession.Mailbox.SetProperties(new PropertyDefinition[]
                    {
                        MailboxSchema.ExtendedRuleSizeLimit
                    }, new object[]
                    {
                        522240
                    });
                    CoreObject.GetPersistablePropertyBag((CoreMailboxObject)mailboxSession.Mailbox.CoreObject).FlushChanges();
                }
                originalSession.Mailbox.ForceReload(new PropertyDefinition[]
                {
                    MailboxSchema.ExtendedRuleSizeLimit
                });
            }
        }
 public PropertyError[] CopyProperties(CoreAttachment destinationAttachment, CopyPropertiesFlags copyPropertiesFlags, NativeStorePropertyDefinition[] includeProperties)
 {
     this.CheckDisposed(null);
     Util.ThrowOnNullArgument(destinationAttachment, "destinationAttachment");
     Util.ThrowOnNullArgument(includeProperties, "includeProperties");
     EnumValidator.ThrowIfInvalid <CopyPropertiesFlags>(copyPropertiesFlags, "copyPropertiesFlags");
     return(CoreObject.MapiCopyProps(this.PropertyBag.MapiProp, destinationAttachment.PropertyBag.MapiProp, this.Session, destinationAttachment.Session, copyPropertiesFlags, includeProperties));
 }
            internal FolderInformation(CoreFolder coreFolder)
            {
                this.propertyBag = CoreObject.GetPersistablePropertyBag(coreFolder);
                this.propertyBag.Load(MapiAclTableRestriction.FolderInformation.PropertyDefinitions);
                string valueOrDefault = this.propertyBag.GetValueOrDefault <string>(StoreObjectSchema.ContainerClass);

                this.storeObjectType = ObjectClass.GetObjectType(valueOrDefault);
            }
        public void Flush()
        {
            this.CheckDisposed(null);
            this.CoreObjectUpdate();
            PersistablePropertyBag persistablePropertyBag = CoreObject.GetPersistablePropertyBag(this.ParentCollection.ContainerItem);

            if (!persistablePropertyBag.Context.IsValidationDisabled)
            {
                ValidationContext context = new ValidationContext(this.Session);
                Validation.Validate(this, context);
            }
            this.PropertyBag.FlushChanges();
        }
Exemple #6
0
 private void InternalConvertToItem(MsgStorageReader reader)
 {
     CoreObject.GetPersistablePropertyBag(base.CoreItem).SaveFlags |= (PropertyBagSaveFlags.IgnoreMapiComputedErrors | PropertyBagSaveFlags.IgnoreUnresolvedHeaders);
     this.reader = reader;
     this.ConvertMessage();
     for (int num = 0; num != this.reader.RecipientCount; num++)
     {
         this.ConvertRecipient(num);
     }
     for (int num2 = 0; num2 != this.reader.AttachmentCount; num2++)
     {
         this.ConvertAttachment(num2);
     }
 }
Exemple #7
0
 public FolderSaveResult Save()
 {
     this.CheckDisposed(null);
     this.ValidateStoreObject();
     try
     {
         CoreObject.GetPersistablePropertyBag(this).FlushChanges();
     }
     catch (PropertyErrorException ex)
     {
         return(new FolderSaveResult(OperationResult.Failed, ex, ex.PropertyErrors));
     }
     CoreObject.GetPersistablePropertyBag(this).SaveChanges(false);
     return(FolderPropertyBag.SuccessfulSave);
 }
 internal void CopyDataToItem(ICoreItem coreItem, bool importResourceFromTnef)
 {
     base.ReplyTo.Resync(true);
     foreach (ConversionItemParticipants.ParticipantDefinitionEntry participantDefinitionEntry in ConversionItemParticipants.ParticipantEntries)
     {
         CoreObject.GetPersistablePropertyBag(coreItem).SetOrDeleteProperty(participantDefinitionEntry.ParticipantProperty, this.propertyBag.TryGetProperty(participantDefinitionEntry.ParticipantProperty));
     }
     CoreObject.GetPersistablePropertyBag(coreItem).SetOrDeleteProperty(InternalSchema.MapiReplyToBlob, this.propertyBag.TryGetProperty(InternalSchema.MapiReplyToBlob));
     CoreObject.GetPersistablePropertyBag(coreItem).SetOrDeleteProperty(InternalSchema.MapiReplyToNames, this.propertyBag.TryGetProperty(InternalSchema.MapiReplyToNames));
     if (this.tnefRecipientList != null)
     {
         Dictionary <ConversionRecipientEntry, ConversionRecipientEntry> dictionary = new Dictionary <ConversionRecipientEntry, ConversionRecipientEntry>();
         foreach (ConversionRecipientEntry conversionRecipientEntry in this.tnefRecipientList)
         {
             dictionary[conversionRecipientEntry] = conversionRecipientEntry;
         }
         foreach (ConversionRecipientEntry conversionRecipientEntry2 in this.recipients)
         {
             ConversionRecipientEntry conversionRecipientEntry3 = null;
             if (dictionary.TryGetValue(conversionRecipientEntry2, out conversionRecipientEntry3) && conversionRecipientEntry3 != null)
             {
                 conversionRecipientEntry2.CopyDependentProperties(conversionRecipientEntry3);
             }
         }
     }
     foreach (ConversionRecipientEntry conversionRecipientEntry4 in this.recipients)
     {
         if (RecipientItemType.Bcc == conversionRecipientEntry4.RecipientItemType)
         {
             importResourceFromTnef = false;
         }
         this.CopyRecipientToMessage(coreItem, conversionRecipientEntry4);
     }
     if (importResourceFromTnef)
     {
         foreach (ConversionRecipientEntry conversionRecipientEntry5 in this.tnefRecipientList)
         {
             if (RecipientItemType.Bcc == conversionRecipientEntry5.RecipientItemType && (conversionRecipientEntry5.Participant.GetValueOrDefault <bool>(ParticipantSchema.IsRoom, false) || conversionRecipientEntry5.Participant.GetValueOrDefault <bool>(ParticipantSchema.IsResource, false)))
             {
                 this.CopyRecipientToMessage(coreItem, conversionRecipientEntry5);
             }
         }
     }
 }
Exemple #9
0
        internal void UndoTnef()
        {
            this.CheckDisposed("UndoTnef");
            this.ClearRecipientTable();
            this.ClearAttachmentTable();
            foreach (PropertyDefinition propertyDefinition in InboundMessageWriter.UndoPropertyList)
            {
                this.coreItem.PropertyBag.Delete(propertyDefinition);
            }
            PersistablePropertyBag persistablePropertyBag = CoreObject.GetPersistablePropertyBag(this.CoreItem);
            IDirectPropertyBag     directPropertyBag      = persistablePropertyBag;

            directPropertyBag.SetValue(InternalSchema.ItemClass, "IPM.Note");
            MessageItem messageItem = this.coreItem as MessageItem;

            if (messageItem != null)
            {
                messageItem.ReplyTo.Clear();
            }
        }
        private void ConvertToItem(TnefReader reader, bool isSummaryTnef)
        {
            if (this.IsReplicationMessage)
            {
                PersistablePropertyBag persistablePropertyBag = CoreObject.GetPersistablePropertyBag(base.MessageWriter.CoreItem);
                if (persistablePropertyBag != null)
                {
                    persistablePropertyBag.Context.IsValidationDisabled = true;
                }
            }
            this.reader                   = reader;
            this.isSummaryTnef            = isSummaryTnef;
            this.isRecipientTablePromoted = false;
            while (this.reader.ReadNextAttribute())
            {
                this.CheckTnefComplianceStatus();
                this.ReadAttribute();
            }
            this.ProcessEndTnef();
            PropertyBagSaveFlags propertyBagSaveFlags = PropertyBagSaveFlags.IgnoreMapiComputedErrors | base.ConversionOptions.GetSaveFlags(base.IsTopLevelMessage);

            CoreObject.GetPersistablePropertyBag(base.CoreItem).SaveFlags |= propertyBagSaveFlags;
        }
 private void CopyRequiredData(MapiMessage sourceMessage)
 {
     CoreObject.MapiCopyTo(sourceMessage, this.underlyingMessage, this.session, this.session, CopyPropertiesFlags.None, CopySubObjects.Copy, CoreCalendarItemVersion.ItemBodyAndAttachmentProperties);
 }
Exemple #12
0
        protected SynchronizerProviderBase(CoreFolder folder, SynchronizerConfigFlags flags, QueryFilter filter, StorageIcsState initialState, PropertyDefinition[] includeProperties, PropertyDefinition[] excludeProperties, short[] unspecifiedIncludeProperties, short[] unspecifiedExcludeProperties, int fastTransferBlockSize)
        {
            this.folder = folder;
            bool flag = false;

            try
            {
                PersistablePropertyBag persistablePropertyBag = CoreObject.GetPersistablePropertyBag(this.folder);
                Restriction            restriction            = null;
                if (filter != null)
                {
                    restriction = FilterRestrictionConverter.CreateRestriction(folder.Session, persistablePropertyBag.ExTimeZone, persistablePropertyBag.MapiProp, filter);
                }
                ICollection <PropTag> includePropertyTags = null;
                if (includeProperties != null && includeProperties.Length > 0)
                {
                    includePropertyTags = PropertyTagCache.Cache.PropTagsFromPropertyDefinitions <PropertyDefinition>(this.MapiFolder, this.folder.Session, true, includeProperties);
                }
                ICollection <PropTag> excludePropertyTags = null;
                if (excludeProperties != null && excludeProperties.Length > 0)
                {
                    excludePropertyTags = PropertyTagCache.Cache.PropTagsFromPropertyDefinitions <PropertyDefinition>(this.MapiFolder, this.folder.Session, true, excludeProperties);
                }
                SynchronizerProviderBase.ReconstituteProperties(unspecifiedIncludeProperties, ref includePropertyTags);
                SynchronizerProviderBase.ReconstituteProperties(unspecifiedExcludeProperties, ref excludePropertyTags);
                StoreSession session    = this.folder.Session;
                object       thisObject = this.folder;
                bool         flag2      = false;
                try
                {
                    if (session != null)
                    {
                        session.BeginMapiCall();
                        session.BeginServerHealthCall();
                        flag2 = true;
                    }
                    if (StorageGlobals.MapiTestHookBeforeCall != null)
                    {
                        StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                    }
                    this.MapiCreateSynchronizer(flags, restriction, initialState, includePropertyTags, excludePropertyTags, fastTransferBlockSize);
                }
                catch (MapiPermanentException ex)
                {
                    throw StorageGlobals.TranslateMapiException(ServerStrings.CannotCreateSynchronizerEx(base.GetType()), ex, session, thisObject, "{0}. MapiException = {1}.", new object[]
                    {
                        string.Format("SynchronizerProviderBase..ctor. Failed to create/configure MapiSynchronizerEx.", new object[0]),
                        ex
                    });
                }
                catch (MapiRetryableException ex2)
                {
                    throw StorageGlobals.TranslateMapiException(ServerStrings.CannotCreateSynchronizerEx(base.GetType()), ex2, session, thisObject, "{0}. MapiException = {1}.", new object[]
                    {
                        string.Format("SynchronizerProviderBase..ctor. Failed to create/configure MapiSynchronizerEx.", new object[0]),
                        ex2
                    });
                }
                finally
                {
                    try
                    {
                        if (session != null)
                        {
                            session.EndMapiCall();
                            if (flag2)
                            {
                                session.EndServerHealthCall();
                            }
                        }
                    }
                    finally
                    {
                        if (StorageGlobals.MapiTestHookAfterCall != null)
                        {
                            StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                        }
                    }
                }
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    base.Dispose();
                }
            }
        }
 protected PropValue[] FromMapiPropValueToXsoPropValue(PropValue[] propValues)
 {
     PropTag[] array = new PropTag[propValues.Length];
     for (int i = 0; i < propValues.Length; i++)
     {
         array[i] = propValues[i].PropTag;
     }
     NativeStorePropertyDefinition[] array2 = PropertyTagCache.Cache.PropertyDefinitionsFromPropTags(NativeStorePropertyDefinition.TypeCheckingFlag.DisableTypeCheck, this.MapiFolder, this.Session, array);
     PropValue[] array3 = new PropValue[propValues.Length];
     for (int j = 0; j < array2.Length; j++)
     {
         if (array2[j] == null)
         {
             throw new NotSupportedException(string.Format("The property tag cannot be resolved to a property definition. PropertyTag = {0}", array[j]));
         }
         object valueFromPropValue = MapiPropertyBag.GetValueFromPropValue(this.Session, CoreObject.GetPersistablePropertyBag(this.folder).ExTimeZone, array2[j], propValues[j]);
         array3[j] = new PropValue(array2[j], valueFromPropValue);
     }
     return(array3);
 }
        internal RecipientTable(ICoreItem item)
        {
            bool flag = false;

            try
            {
                StorageGlobals.TraceConstructIDisposable(this);
                if (item.Session == null)
                {
                    this.recipientTable = null;
                }
                else
                {
                    this.mapiMessage  = (MapiMessage)CoreObject.GetPersistablePropertyBag(item).MapiProp;
                    this.storeSession = item.Session;
                    this.timeZone     = CoreObject.GetPersistablePropertyBag(item).ExTimeZone;
                    StoreSession storeSession = this.storeSession;
                    bool         flag2        = false;
                    try
                    {
                        if (storeSession != null)
                        {
                            storeSession.BeginMapiCall();
                            storeSession.BeginServerHealthCall();
                            flag2 = true;
                        }
                        if (StorageGlobals.MapiTestHookBeforeCall != null)
                        {
                            StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                        }
                        this.recipientTable = this.mapiMessage.GetRecipientTable();
                    }
                    catch (MapiPermanentException ex)
                    {
                        throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotGetRecipientTable, ex, storeSession, this, "{0}. MapiException = {1}.", new object[]
                        {
                            string.Format("RecipientTable::Storage.RecipientTable.", new object[0]),
                            ex
                        });
                    }
                    catch (MapiRetryableException ex2)
                    {
                        throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotGetRecipientTable, ex2, storeSession, this, "{0}. MapiException = {1}.", new object[]
                        {
                            string.Format("RecipientTable::Storage.RecipientTable.", new object[0]),
                            ex2
                        });
                    }
                    finally
                    {
                        try
                        {
                            if (storeSession != null)
                            {
                                storeSession.EndMapiCall();
                                if (flag2)
                                {
                                    storeSession.EndServerHealthCall();
                                }
                            }
                        }
                        finally
                        {
                            if (StorageGlobals.MapiTestHookAfterCall != null)
                            {
                                StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                            }
                        }
                    }
                }
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    base.Dispose();
                }
            }
        }
        private ContactLinkingProcessingState InspectNotification(COWTriggerAction operation, StoreSession session, CoreItem item, bool onBeforeNotification, bool onDumpster)
        {
            if (onDumpster)
            {
                return(ContactLinkingProcessingState.DoNotProcess);
            }
            if (!onBeforeNotification)
            {
                return(ContactLinkingProcessingState.DoNotProcess);
            }
            if (item == null)
            {
                return(ContactLinkingProcessingState.Unknown);
            }
            if (!(session is MailboxSession))
            {
                COWContactLinking.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLinking.InspectNotification: not a mailbox session.");
                return(ContactLinkingProcessingState.DoNotProcess);
            }
            if (operation != COWTriggerAction.Create && operation != COWTriggerAction.Update)
            {
                COWContactLinking.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLinking.InspectNotification: not an Create or Update operation.");
                return(ContactLinkingProcessingState.DoNotProcess);
            }
            PersistablePropertyBag persistablePropertyBag = CoreObject.GetPersistablePropertyBag(item);

            switch (persistablePropertyBag.Context.AutomaticContactLinkingAction)
            {
            case AutomaticContactLinkingAction.ClientBased:
                if (!this.IsClientAllowed(session.ClientInfoString))
                {
                    COWContactLinking.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLinking.InspectNotification: not allowed client session.");
                    return(ContactLinkingProcessingState.DoNotProcess);
                }
                break;

            case AutomaticContactLinkingAction.Ignore:
                COWContactLinking.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLinking.InspectNotification: IgnoreAutomaticContactLinking=true.");
                return(ContactLinkingProcessingState.DoNotProcess);
            }
            if (session.LogonType != LogonType.Owner && session.LogonType != LogonType.Delegated)
            {
                COWContactLinking.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLinking.InspectNotification: logon session is not user or delegated.");
                return(ContactLinkingProcessingState.DoNotProcess);
            }
            string valueOrDefault = item.PropertyBag.GetValueOrDefault <string>(StoreObjectSchema.ItemClass, string.Empty);

            if (string.IsNullOrEmpty(valueOrDefault))
            {
                return(ContactLinkingProcessingState.Unknown);
            }
            if (ObjectClass.IsPlace(valueOrDefault))
            {
                COWContactLinking.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLinking.InspectNotification: place item class are not processed.");
                return(ContactLinkingProcessingState.DoNotProcess);
            }
            if (!ObjectClass.IsContact(valueOrDefault))
            {
                COWContactLinking.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLinking.InspectNotification: item class is not contact.");
                return(ContactLinkingProcessingState.DoNotProcess);
            }
            if (operation == COWTriggerAction.Update && !Array.Exists <StorePropertyDefinition>(COWContactLinking.NotificationProperties, (StorePropertyDefinition property) => item.PropertyBag.IsPropertyDirty(property)))
            {
                COWContactLinking.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLinking.InspectNotification: no relevant properties changed");
                return(ContactLinkingProcessingState.Unknown);
            }
            if (ClientInfo.MOMT.IsMatch(session.ClientInfoString))
            {
                return(ContactLinkingProcessingState.ProcessAfterSave);
            }
            return(ContactLinkingProcessingState.ProcessBeforeSave);
        }
        private static MapiModifyTable GetMapiModifyTable(CoreFolder coreFolder, NativeStorePropertyDefinition property)
        {
            PersistablePropertyBag persistablePropertyBag = CoreObject.GetPersistablePropertyBag(coreFolder);
            PropTag         propTag      = PropertyTagCache.Cache.PropTagFromPropertyDefinition(persistablePropertyBag.MapiProp, coreFolder.Session, property);
            StoreSession    storeSession = coreFolder.Session;
            object          thisObject   = null;
            bool            flag         = false;
            MapiModifyTable result;

            try
            {
                if (storeSession != null)
                {
                    storeSession.BeginMapiCall();
                    storeSession.BeginServerHealthCall();
                    flag = true;
                }
                if (StorageGlobals.MapiTestHookBeforeCall != null)
                {
                    StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                }
                result = (MapiModifyTable)persistablePropertyBag.MapiProp.OpenProperty(propTag, PropertyTable.IExchangeModifyTableInterfaceId, 0, OpenPropertyFlags.DeferredErrors);
            }
            catch (MapiPermanentException ex)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotGetMapiTable, ex, storeSession, thisObject, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("PropertyTable.GetMapiModifyTable. Unable to get MapiModifyTable.", new object[0]),
                    ex
                });
            }
            catch (MapiRetryableException ex2)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotGetMapiTable, ex2, storeSession, thisObject, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("PropertyTable.GetMapiModifyTable. Unable to get MapiModifyTable.", new object[0]),
                    ex2
                });
            }
            finally
            {
                try
                {
                    if (storeSession != null)
                    {
                        storeSession.EndMapiCall();
                        if (flag)
                        {
                            storeSession.EndServerHealthCall();
                        }
                    }
                }
                finally
                {
                    if (StorageGlobals.MapiTestHookAfterCall != null)
                    {
                        StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                    }
                }
            }
            return(result);
        }
Exemple #17
0
 internal void SetSubjectProperty(NativeStorePropertyDefinition property, string value)
 {
     this.CheckDisposed("SetSubjectProperty");
     SubjectProperty.ModifySubjectProperty(CoreObject.GetPersistablePropertyBag(this.coreItem), property, value);
 }
        protected ManifestProviderBase(CoreFolder folder, ManifestConfigFlags flags, QueryFilter filter, StorageIcsState initialState, PropertyDefinition[] includeProperties, PropertyDefinition[] excludeProperties)
        {
            this.folder         = folder;
            this.disposeTracker = this.GetDisposeTracker();
            bool flag = false;

            try
            {
                PersistablePropertyBag persistablePropertyBag = CoreObject.GetPersistablePropertyBag(this.folder);
                Restriction            restriction            = null;
                if (filter != null)
                {
                    restriction = FilterRestrictionConverter.CreateRestriction(folder.Session, persistablePropertyBag.ExTimeZone, persistablePropertyBag.MapiProp, filter);
                }
                ICollection <PropTag> includePropertyTags = PropertyTagCache.Cache.PropTagsFromPropertyDefinitions <PropertyDefinition>(this.MapiFolder, this.Session, true, includeProperties);
                ICollection <PropTag> excludePropertyTags = PropertyTagCache.Cache.PropTagsFromPropertyDefinitions <PropertyDefinition>(this.MapiFolder, this.Session, true, excludeProperties);
                StoreSession          session             = this.Session;
                object thisObject = this.folder;
                bool   flag2      = false;
                try
                {
                    if (session != null)
                    {
                        session.BeginMapiCall();
                        session.BeginServerHealthCall();
                        flag2 = true;
                    }
                    if (StorageGlobals.MapiTestHookBeforeCall != null)
                    {
                        StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                    }
                    this.mapiManifest = this.MapiCreateManifest(flags, restriction, initialState, includePropertyTags, excludePropertyTags);
                }
                catch (MapiPermanentException ex)
                {
                    throw StorageGlobals.TranslateMapiException(ServerStrings.CannotCreateManifestEx(base.GetType()), ex, session, thisObject, "{0}. MapiException = {1}.", new object[]
                    {
                        string.Format("ManifestProviderBase..ctor. Failed to create/configure HierarchyManifestEx.", new object[0]),
                        ex
                    });
                }
                catch (MapiRetryableException ex2)
                {
                    throw StorageGlobals.TranslateMapiException(ServerStrings.CannotCreateManifestEx(base.GetType()), ex2, session, thisObject, "{0}. MapiException = {1}.", new object[]
                    {
                        string.Format("ManifestProviderBase..ctor. Failed to create/configure HierarchyManifestEx.", new object[0]),
                        ex2
                    });
                }
                finally
                {
                    try
                    {
                        if (session != null)
                        {
                            session.EndMapiCall();
                            if (flag2)
                            {
                                session.EndServerHealthCall();
                            }
                        }
                    }
                    finally
                    {
                        if (StorageGlobals.MapiTestHookAfterCall != null)
                        {
                            StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                        }
                    }
                }
                flag = true;
            }
            finally
            {
                if (!flag)
                {
                    base.Dispose();
                }
            }
        }
Exemple #19
0
        internal static PropertyError[] MapiCopyProps(MapiProp source, MapiProp destination, StoreSession sourceSession, StoreSession destSession, CopyPropertiesFlags copyPropertiesFlags, params NativeStorePropertyDefinition[] includedProperties)
        {
            Util.ThrowOnNullArgument(source, "sources");
            Util.ThrowOnNullArgument(destination, "destination");
            ICollection <PropTag> collection = PropertyTagCache.Cache.PropTagsFromPropertyDefinitions(source, sourceSession, true, includedProperties);

            PropProblem[] problems = null;
            bool          flag     = false;

            try
            {
                if (sourceSession != null)
                {
                    sourceSession.BeginMapiCall();
                    sourceSession.BeginServerHealthCall();
                    flag = true;
                }
                if (StorageGlobals.MapiTestHookBeforeCall != null)
                {
                    StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                }
                CopyPropertiesFlags copyPropertiesFlags2 = CoreObject.ToCopyPropertiesFlags(copyPropertiesFlags);
                try
                {
                    problems = source.CopyProps(destination, copyPropertiesFlags2, collection);
                }
                catch (MapiExceptionNamedPropsQuotaExceeded)
                {
                    List <PropTag> list = new List <PropTag>(collection.Count);
                    foreach (PropTag propTag in collection)
                    {
                        if (propTag != PropTag.Unresolved)
                        {
                            list.Add(propTag);
                        }
                    }
                    problems = source.CopyProps(destination, copyPropertiesFlags2, list);
                }
            }
            catch (MapiPermanentException ex)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotCopyMapiProps, ex, sourceSession, source, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("CoreItem::MapiCopyProperties.", new object[0]),
                    ex
                });
            }
            catch (MapiRetryableException ex2)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.MapiCannotCopyMapiProps, ex2, sourceSession, source, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("CoreItem::MapiCopyProperties.", new object[0]),
                    ex2
                });
            }
            finally
            {
                try
                {
                    if (sourceSession != null)
                    {
                        sourceSession.EndMapiCall();
                        if (flag)
                        {
                            sourceSession.EndServerHealthCall();
                        }
                    }
                }
                finally
                {
                    if (StorageGlobals.MapiTestHookAfterCall != null)
                    {
                        StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                    }
                }
            }
            CoreObject.ProcessCopyPropertyProblems(problems, sourceSession, source);
            return(CoreObject.ToXsoPropertyErrors(destSession, destination, problems));
        }
Exemple #20
0
 void IValidatable.Validate(ValidationContext context, IList <StoreObjectValidationError> validationErrors)
 {
     this.CheckDisposed(null);
     Validation.ValidateProperties(context, this, CoreObject.GetPersistablePropertyBag(this), validationErrors);
     this.ValidateContainedObjects(validationErrors);
 }