Пример #1
0
        internal static void Delete(Folder folder, string searchString, UserConfigurationSearchFlags searchFlags)
        {
            EnumValidator.AssertValid <UserConfigurationSearchFlags>(searchFlags);
            if (searchFlags != UserConfigurationSearchFlags.SubString && searchFlags != UserConfigurationSearchFlags.FullString && searchFlags != UserConfigurationSearchFlags.Prefix)
            {
                ExTraceGlobals.StorageTracer.TraceError <UserConfigurationSearchFlags>(0L, "UserConfiguration::FindItems. The search flag is not supported. searchFlags = {0}.", searchFlags);
                throw new NotSupportedException();
            }
            IList <IStorePropertyBag> list = null;

            try
            {
                list = UserConfiguration.QueryConfigurations(folder, null, new UserConfigurationName(searchString, ConfigurationNameKind.PartialName), searchFlags, StorageLimits.Instance.UserConfigurationMaxSearched, new PropertyDefinition[0]);
            }
            catch (InvalidOperationException innerException)
            {
                throw new InvalidOperationException(ServerStrings.ExCannotQueryAssociatedTable, innerException);
            }
            List <VersionedId> list2 = new List <VersionedId>();

            for (int i = 0; i < list.Count; i++)
            {
                list2.Add((VersionedId)list[i][InternalSchema.ItemId]);
                if (i == list.Count - 1 || list2.Count > 100)
                {
                    AggregateOperationResult result = folder.Session.Delete(DeleteItemFlags.SoftDelete, list2.ToArray());
                    UserConfiguration.CheckOperationResults(result, "Delete");
                    list2.Clear();
                }
            }
        }
Пример #2
0
        public override Stream OpenPropertyStream(PropertyDefinition propertyDefinition, PropertyOpenMode openMode)
        {
            base.CheckDisposed("OpenPropertyStream");
            EnumValidator.AssertValid <PropertyOpenMode>(openMode);
            NativeStorePropertyDefinition nativeStorePropertyDefinition = propertyDefinition as NativeStorePropertyDefinition;

            if (nativeStorePropertyDefinition == null)
            {
                throw new InvalidOperationException(ServerStrings.ExPropertyNotStreamable(propertyDefinition.ToString()));
            }
            Stream result;

            using (DisposeGuard disposeGuard = default(DisposeGuard))
            {
                StoreObjectStream storeObjectStream = new StoreObjectStream(this, nativeStorePropertyDefinition, openMode);
                disposeGuard.Add <StoreObjectStream>(storeObjectStream);
                this.listOfStreams.Add(storeObjectStream);
                disposeGuard.Success();
                if (openMode == PropertyOpenMode.Create || openMode == PropertyOpenMode.Modify)
                {
                    this.TrackProperty(nativeStorePropertyDefinition, true);
                }
                result = storeObjectStream;
            }
            return(result);
        }
Пример #3
0
        public static void PerformActionOnNativePropertyDefinitions <T>(PropertyDependencyType targetDependencyType, ICollection <T> propertyDefinitions, Action <NativeStorePropertyDefinition> action) where T : PropertyDefinition
        {
            EnumValidator.AssertValid <PropertyDependencyType>(targetDependencyType);
            if (propertyDefinitions == null)
            {
                return;
            }
            int actualDependencyCount = 0;

            foreach (T t in propertyDefinitions)
            {
                PropertyDefinition      propertyDefinition      = t;
                StorePropertyDefinition storePropertyDefinition = InternalSchema.ToStorePropertyDefinition(propertyDefinition);
                storePropertyDefinition.ForEachMatch(targetDependencyType, delegate(NativeStorePropertyDefinition item)
                {
                    action(item);
                    actualDependencyCount++;
                });
            }
            int num = (propertyDefinitions.Count >= StorePropertyDefinition.dependencyEstimates.Length) ? propertyDefinitions.Count : StorePropertyDefinition.dependencyEstimates[propertyDefinitions.Count];

            if (actualDependencyCount != num && propertyDefinitions.Count < StorePropertyDefinition.dependencyEstimates.Length)
            {
                Interlocked.Exchange(ref StorePropertyDefinition.dependencyEstimates[propertyDefinitions.Count], actualDependencyCount);
            }
        }
Пример #4
0
 public override Stream OpenPropertyStream(PropertyDefinition propertyDefinition, PropertyOpenMode openMode)
 {
     base.CheckDisposed("OpenPropertyStream");
     EnumValidator.AssertValid <PropertyOpenMode>(openMode);
     this.OnOpenConnection();
     return(this.persistablePropertyBag.OpenPropertyStream(propertyDefinition, openMode));
 }
 public EwsConnectionManager(ExchangePrincipal principal, OpenAsAdminOrSystemServiceBudgetTypeType budgetType, Trace tracer)
 {
     EnumValidator.AssertValid <OpenAsAdminOrSystemServiceBudgetTypeType>(budgetType);
     this.budgetType = budgetType;
     this.currentExchangePrincipal = principal;
     this.Tracer = tracer;
 }
Пример #6
0
 private UserConfiguration(UserConfigurationName configurationName, UserConfigurationTypes type, IStorePropertyBag queryPropertyBag)
 {
     EnumValidator.AssertValid <UserConfigurationTypes>(type);
     this.queryPropertyBag = queryPropertyBag;
     StorageGlobals.TraceConstructIDisposable(this);
     this.disposeTracker = this.GetDisposeTracker();
 }
Пример #7
0
        internal static ICollection <UserConfiguration> Find(Folder folder, string searchString, UserConfigurationSearchFlags searchFlags)
        {
            EnumValidator.AssertValid <UserConfigurationSearchFlags>(searchFlags);
            List <UserConfiguration> list = new List <UserConfiguration>();

            if (searchFlags != UserConfigurationSearchFlags.SubString && searchFlags != UserConfigurationSearchFlags.FullString && searchFlags != UserConfigurationSearchFlags.Prefix)
            {
                ExTraceGlobals.StorageTracer.TraceError <UserConfigurationSearchFlags>(0L, "UserConfiguration::FindItems. The search flag is not supported. searchFlags = {0}.", searchFlags);
                throw new NotSupportedException(ServerStrings.ExNotSupportedConfigurationSearchFlags(searchFlags.ToString()));
            }
            IList <IStorePropertyBag> list2 = null;

            try
            {
                list2 = UserConfiguration.QueryConfigurations(folder, null, new UserConfigurationName(searchString, ConfigurationNameKind.PartialName), searchFlags, StorageLimits.Instance.UserConfigurationMaxSearched + 1, new PropertyDefinition[0]);
            }
            catch (InvalidOperationException innerException)
            {
                throw new InvalidOperationException(ServerStrings.ExCannotQueryAssociatedTable, innerException);
            }
            if (list2.Count > StorageLimits.Instance.UserConfigurationMaxSearched)
            {
                ExTraceGlobals.StorageTracer.TraceError <int, int>(0L, "UserConfiguration::FindItems. There are too many user configuration objects created with the same name. Max. = {0}, Find = {1}.", StorageLimits.Instance.UserConfigurationMaxSearched, list2.Count);
                throw new TooManyConfigurationObjectsException(ServerStrings.ExTooManyObjects(searchString, list2.Count, StorageLimits.Instance.UserConfigurationMaxSearched));
            }
            if (list2.Count > 0)
            {
                UserConfiguration.BuildConfigurationsFromFilterQuery(list2, folder, list);
            }
            return(list);
        }
Пример #8
0
        private static ICollection <NativeStorePropertyDefinition> GetNativePropertyDefinitions <T>(PropertyDependencyType targetDependencyType, ICollection <T> propertyDefinitions, bool hashSetOrList, Predicate <NativeStorePropertyDefinition> addToCollection) where T : PropertyDefinition
        {
            EnumValidator.AssertValid <PropertyDependencyType>(targetDependencyType);
            if (propertyDefinitions == null)
            {
                return(StorePropertyDefinition.EmptyNativeStoreProperties);
            }
            int num = (propertyDefinitions.Count >= StorePropertyDefinition.dependencyEstimates.Length) ? propertyDefinitions.Count : StorePropertyDefinition.dependencyEstimates[propertyDefinitions.Count];
            ICollection <NativeStorePropertyDefinition> collection = null;
            Action <NativeStorePropertyDefinition>      action;

            if (hashSetOrList)
            {
                HashSet <NativeStorePropertyDefinition> nativePropertyDefinitionsSet = new HashSet <NativeStorePropertyDefinition>(num);
                action = delegate(NativeStorePropertyDefinition item)
                {
                    if (addToCollection == null)
                    {
                        nativePropertyDefinitionsSet.TryAdd(item);
                        return;
                    }
                    if (addToCollection(item))
                    {
                        nativePropertyDefinitionsSet.TryAdd(item);
                    }
                };
                collection = nativePropertyDefinitionsSet;
            }
            else
            {
                IList <NativeStorePropertyDefinition> loadList = new List <NativeStorePropertyDefinition>(num);
                action = delegate(NativeStorePropertyDefinition item)
                {
                    if (addToCollection == null)
                    {
                        loadList.Add(item);
                        return;
                    }
                    if (addToCollection(item))
                    {
                        loadList.Add(item);
                    }
                };
                collection = loadList;
            }
            foreach (T t in propertyDefinitions)
            {
                PropertyDefinition      propertyDefinition      = t;
                StorePropertyDefinition storePropertyDefinition = InternalSchema.ToStorePropertyDefinition(propertyDefinition);
                storePropertyDefinition.ForEachMatch(targetDependencyType, action);
            }
            int count = collection.Count;

            if (count != num && propertyDefinitions.Count < StorePropertyDefinition.dependencyEstimates.Length)
            {
                Interlocked.Exchange(ref StorePropertyDefinition.dependencyEstimates[propertyDefinitions.Count], count);
            }
            return(collection);
        }
 internal OneOffParticipantEntryId(string displayName, string addressType, string address, OneOffFlag flags)
 {
     EnumValidator.AssertValid <OneOffFlag>(flags);
     this.emailDisplayName = Util.NullIf <string>(displayName, string.Empty);
     this.emailAddressType = Util.NullIf <string>(addressType, string.Empty);
     this.emailAddress     = Util.NullIf <string>(address, string.Empty);
     this.flags            = flags;
 }
Пример #10
0
 internal void Initialize(string itemClassPrefix, ResponseType responseType)
 {
     base.Initialize();
     EnumValidator.AssertValid <ResponseType>(responseType);
     base.LocationIdentifierHelperInstance.SetLocationIdentifier(55413U);
     this[InternalSchema.ItemClass] = MeetingResponse.ItemClassFromResponseType(itemClassPrefix, responseType);
     this[InternalSchema.IconIndex] = IconIndex.AppointmentMeet;
 }
Пример #11
0
 internal StoreParticipantEntryId(ParticipantEntryId.WabEntryFlag flags, ParticipantEntryId.Reader reader)
 {
     EnumValidator.AssertValid <ParticipantEntryId.WabEntryFlag>(flags);
     this.isMapiPDL         = StoreParticipantEntryId.WabEntryFlagToMapiPDL(flags);
     this.emailAddressIndex = StoreParticipantEntryId.WabEntryFlagToEmailAddressIndex(flags);
     this.ltEntryId         = reader.ReadLTEntryId();
     this.useWabFormat      = true;
     reader.EnsureEnd();
 }
 internal FolderCreatePropertyBag(StoreSession storeSession, StoreObjectId parentFolderId, bool isSearchFolder, CreateMode createMode, bool isSecure, ICollection <PropertyDefinition> properties) : base(storeSession, null, properties)
 {
     Util.ThrowOnNullArgument(storeSession, "storeSession");
     Util.ThrowOnNullArgument(parentFolderId, "parentFolderId");
     EnumValidator.AssertValid <CreateMode>(createMode);
     this.parentFolderId = parentFolderId;
     this.isSearchFolder = isSearchFolder;
     this.createMode     = createMode;
     this.isSecure       = isSecure;
 }
Пример #13
0
        public sealed override Stream OpenPropertyStream(PropertyDefinition propertyDefinition, PropertyOpenMode openMode)
        {
            EnumValidator.AssertValid <PropertyOpenMode>(openMode);
            NativeStorePropertyDefinition nativeStorePropertyDefinition = propertyDefinition as NativeStorePropertyDefinition;

            if (nativeStorePropertyDefinition == null)
            {
                throw new InvalidOperationException(ServerStrings.ExPropertyNotStreamable(propertyDefinition.ToString()));
            }
            return(new FolderPropertyStream(base.MapiPropertyBag, nativeStorePropertyDefinition, openMode));
        }
Пример #14
0
 internal void InternalSet(EmailAddressIndex key, Participant value)
 {
     EnumValidator.AssertValid <EmailAddressIndex>(key);
     Contact.EmailAddressDictionary.Check(key);
     if (value != null)
     {
         base[key] = value;
         return;
     }
     base.Remove(key);
 }
Пример #15
0
 protected StoreObjectId(byte[] entryId, StoreObjectType itemType)
 {
     Util.ThrowOnNullArgument(entryId, "entryId");
     EnumValidator.AssertValid <StoreObjectType>(itemType);
     if (entryId.Length > 255)
     {
         throw new CorruptDataException(ServerStrings.ExEntryIdToLong);
     }
     this.EntryId = entryId;
     this.SetObjectType(itemType);
     this.Validate();
 }
Пример #16
0
 private static string EncodeReplyForwardStatus(LastAction lastAction, IconIndex iconIndex, string parentMessageItemIdBase64String)
 {
     EnumValidator.AssertValid <IconIndex>(iconIndex);
     return(string.Format("{0}{1}{2}{3}{4}", new object[]
     {
         (int)lastAction,
         ',',
         (int)iconIndex,
         ',',
         parentMessageItemIdBase64String
     }));
 }
Пример #17
0
 private StoreParticipantEntryId(StoreObjectId itemId, bool isMapiPDL, EmailAddressIndex emailIndex, bool useWabFormat)
 {
     EnumValidator.AssertValid <EmailAddressIndex>(emailIndex);
     using (ParticipantEntryId.Reader reader = new ParticipantEntryId.Reader(itemId.ProviderLevelItemId))
     {
         this.ltEntryId = reader.ReadLTEntryId();
         reader.EnsureEnd();
     }
     this.isMapiPDL         = isMapiPDL;
     this.emailAddressIndex = emailIndex;
     this.useWabFormat      = useWabFormat;
 }
Пример #18
0
 private static void Stop(AuditingOpticsLoggerType loggerType)
 {
     EnumValidator.AssertValid <AuditingOpticsLoggerType>(loggerType);
     lock (AuditingOpticsLogger.instanceLock)
     {
         AuditingOpticsLoggerInstance auditingOpticsLoggerInstance = AuditingOpticsLogger.instances[(int)loggerType];
         if (auditingOpticsLoggerInstance != null)
         {
             auditingOpticsLoggerInstance.Stop();
             AuditingOpticsLogger.instances[(int)loggerType] = null;
         }
     }
 }
 internal PropertyComparisonConstraint(StorePropertyDefinition leftPropertyDefinition, StorePropertyDefinition rightPropertyDefinition, ComparisonOperator comparisonOperator) : base(new PropertyDefinition[]
 {
     leftPropertyDefinition,
     rightPropertyDefinition
 })
 {
     EnumValidator.AssertValid <ComparisonOperator>(comparisonOperator);
     if (comparisonOperator != ComparisonOperator.Equal && comparisonOperator != ComparisonOperator.NotEqual && !typeof(IComparable).GetTypeInfo().IsAssignableFrom(leftPropertyDefinition.Type.GetTypeInfo()))
     {
         throw new NotSupportedException(ServerStrings.ExConstraintNotSupportedForThisPropertyType);
     }
     this.leftPropertyDefinition  = leftPropertyDefinition;
     this.rightPropertyDefinition = rightPropertyDefinition;
     this.comparisonOperator      = comparisonOperator;
 }
Пример #20
0
 internal StoreObjectId this[DefaultFolderType defaultFolderType]
 {
     get
     {
         EnumValidator.AssertValid <DefaultFolderType>(defaultFolderType);
         DefaultFolder defaultFolder = this.defaultFolders[(int)defaultFolderType];
         if (defaultFolder != null)
         {
             StoreObjectId result;
             defaultFolder.TryGetFolderId(out result);
             return(result);
         }
         return(null);
     }
 }
Пример #21
0
        internal static IAuditingOpticsLoggerInstance GetInstance(AuditingOpticsLoggerType loggerType)
        {
            EnumValidator.AssertValid <AuditingOpticsLoggerType>(loggerType);
            if (AuditingOpticsLogger.auditingOpticsLoggerInstanceHook.Value != null)
            {
                return(AuditingOpticsLogger.auditingOpticsLoggerInstanceHook.Value);
            }
            IAuditingOpticsLoggerInstance result;

            lock (AuditingOpticsLogger.instanceLock)
            {
                AuditingOpticsLoggerInstance auditingOpticsLoggerInstance = AuditingOpticsLogger.instances[(int)loggerType];
                if (auditingOpticsLoggerInstance == null)
                {
                    auditingOpticsLoggerInstance = new AuditingOpticsLoggerInstance(loggerType);
                    AuditingOpticsLogger.instances[(int)loggerType] = auditingOpticsLoggerInstance;
                }
                result = auditingOpticsLoggerInstance;
            }
            return(result);
        }
Пример #22
0
        internal AuditingOpticsLoggerInstance(AuditingOpticsLoggerType loggerType)
        {
            EnumValidator.AssertValid <AuditingOpticsLoggerType>(loggerType);
            AuditingOpticsLoggerSettings auditingOpticsLoggerSettings = AuditingOpticsLoggerSettings.Load();

            if (auditingOpticsLoggerSettings.Enabled)
            {
                this.Enabled    = true;
                this.LoggerType = loggerType;
                if (this.IsDebugTraceEnabled())
                {
                    this.SafeTraceDebug(0L, "Start creating Auditing Optics log.", new object[0]);
                }
                this.LogSchema = new LogSchema(AuditingOpticsConstants.SoftwareName, "15.00.1497.012", this.LogTypeName, this.GetLogFields());
                LogHeaderFormatter headerFormatter = new LogHeaderFormatter(this.LogSchema);
                this.Logger = new Log(this.FileNamePrefix, headerFormatter, this.LogComponentName);
                if (this.IsDebugTraceEnabled())
                {
                    this.SafeTraceDebug(0L, "Start configuring the Auditing Optics log.", new object[0]);
                }
                this.Logger.Configure(Path.Combine(auditingOpticsLoggerSettings.DirectoryPath, this.FileNamePrefix), auditingOpticsLoggerSettings.MaxAge, (long)auditingOpticsLoggerSettings.MaxDirectorySize.ToBytes(), (long)auditingOpticsLoggerSettings.MaxFileSize.ToBytes(), (int)auditingOpticsLoggerSettings.CacheSize.ToBytes(), auditingOpticsLoggerSettings.FlushInterval, auditingOpticsLoggerSettings.FlushToDisk);
                if (this.IsDebugTraceEnabled())
                {
                    this.SafeTraceDebug(0L, "Auditing Optics log on server '{0}' is created and ready for use.", new object[]
                    {
                        this.ServerName
                    });
                    return;
                }
            }
            else
            {
                this.Enabled = false;
                if (this.IsDebugTraceEnabled())
                {
                    this.SafeTraceDebug(0L, "The Auditing Optics log is disabled.", new object[0]);
                }
            }
        }
Пример #23
0
 public override Stream OpenPropertyStream(PropertyDefinition propertyDefinition, PropertyOpenMode openMode)
 {
     base.CheckDisposed("AcrPropertyBag::OpenPropertyStream");
     EnumValidator.AssertValid <PropertyOpenMode>(openMode);
     if (openMode != PropertyOpenMode.ReadOnly)
     {
         if (this.Mode == AcrPropertyBag.AcrMode.ReadOnly)
         {
             ExTraceGlobals.StorageTracer.TraceError <int, PropertyOpenMode>((long)this.GetHashCode(), "AcrPropertyBag::SetProperties {0}, OpenPropertyStream called for readonly AcrPropertyBag with opemMode = {1}", this.GetHashCode(), openMode);
             throw new AccessDeniedException(ServerStrings.ExItemIsOpenedInReadOnlyMode);
         }
         if (!this.propertiesWrittenAsStream.ContainsKey(propertyDefinition))
         {
             if (this.propertyTrackingCache.ContainsKey(propertyDefinition))
             {
                 ExTraceGlobals.StorageTracer.Information <int, string>((long)this.GetHashCode(), "AcrPropertyBag::OpenPropertyStream HashCode[{0}]: PropertyRemoved from acr {1}", this.GetHashCode(), propertyDefinition.Name);
                 this.propertyTrackingCache.Remove(propertyDefinition);
             }
             this.propertiesWrittenAsStream.Add(propertyDefinition, propertyDefinition);
         }
     }
     return(this.propertyBag.OpenPropertyStream(propertyDefinition, openMode));
 }
Пример #24
0
        internal Stream OpenPropertyStream(NativeStorePropertyDefinition propertyDefinition, PropertyOpenMode openMode, bool bufferStream)
        {
            this.CheckDisposed("OpenPropertyStream");
            EnumValidator.AssertValid <PropertyOpenMode>(openMode);
            PropTag           propTag = PropertyTagCache.Cache.PropTagFromPropertyDefinition(this.MapiProp, this.storeSession, propertyDefinition);
            OpenPropertyFlags flags;

            switch (openMode)
            {
            case PropertyOpenMode.ReadOnly:
                flags = OpenPropertyFlags.DeferredErrors;
                break;

            case PropertyOpenMode.Modify:
                flags = OpenPropertyFlags.Modify;
                break;

            case PropertyOpenMode.Create:
                flags = (OpenPropertyFlags.Create | OpenPropertyFlags.Modify);
                break;

            default:
                throw new ArgumentException(ServerStrings.ExInvalidParameter("openMode", 2), "openMode");
            }
            Stream       stream       = null;
            StoreSession storeSession = this.StoreSession;
            bool         flag         = false;

            try
            {
                if (storeSession != null)
                {
                    storeSession.BeginMapiCall();
                    storeSession.BeginServerHealthCall();
                    flag = true;
                }
                if (StorageGlobals.MapiTestHookBeforeCall != null)
                {
                    StorageGlobals.MapiTestHookBeforeCall(MethodBase.GetCurrentMethod());
                }
                stream = new MapiStreamWrapper(this.MapiProp.OpenStream(propTag, flags), this.StoreSession);
            }
            catch (MapiPermanentException ex)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.ExUnableToGetStreamProperty(propertyDefinition.Name), ex, storeSession, this, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("MapiPropertyBag::OpenPropertyStream. Failed to open property stream for property {0}, openMode = {1}.", propertyDefinition, openMode),
                    ex
                });
            }
            catch (MapiRetryableException ex2)
            {
                throw StorageGlobals.TranslateMapiException(ServerStrings.ExUnableToGetStreamProperty(propertyDefinition.Name), ex2, storeSession, this, "{0}. MapiException = {1}.", new object[]
                {
                    string.Format("MapiPropertyBag::OpenPropertyStream. Failed to open property stream for property {0}, openMode = {1}.", propertyDefinition, openMode),
                    ex2
                });
            }
            finally
            {
                try
                {
                    if (storeSession != null)
                    {
                        storeSession.EndMapiCall();
                        if (flag)
                        {
                            storeSession.EndServerHealthCall();
                        }
                    }
                }
                finally
                {
                    if (StorageGlobals.MapiTestHookAfterCall != null)
                    {
                        StorageGlobals.MapiTestHookAfterCall(MethodBase.GetCurrentMethod());
                    }
                }
            }
            if (bufferStream)
            {
                stream = new PooledBufferedStream(stream, StorageLimits.Instance.PropertyStreamPageSize);
            }
            return(stream);
        }
 protected SimpleVirtualPropertyDefinition(PropertyTypeSpecifier specifiedWith, string displayName, Type propertyValueType, PropertyFlags flags, params PropertyDefinitionConstraint[] constraints) : base(specifiedWith, displayName, propertyValueType, flags, constraints)
 {
     EnumValidator.AssertValid <PropertyFlags>(flags);
     this.hashCode = new LazilyInitialized <int>(new Func <int>(this.ComputeHashCode));
 }
Пример #26
0
        internal static UserConfiguration GetIgnoringCache(UserConfigurationManager manager, Folder folder, UserConfigurationName configurationName, UserConfigurationTypes freefetchType)
        {
            EnumValidator.AssertValid <UserConfigurationTypes>(freefetchType);
            UserConfiguration userConfiguration = null;

            PropertyDefinition[] columns;
            if ((freefetchType & UserConfigurationTypes.Dictionary) > (UserConfigurationTypes)0)
            {
                columns = new PropertyDefinition[]
                {
                    InternalSchema.UserConfigurationDictionary
                };
            }
            else
            {
                columns = UserConfiguration.ZeroProperties;
            }
            SortBy[] sorts = new SortBy[]
            {
                new SortBy(InternalSchema.CreationTime, SortOrder.Ascending),
                new SortBy(InternalSchema.MID, SortOrder.Ascending)
            };
            IList <IStorePropertyBag> list = null;

            try
            {
                ExTraceGlobals.UserConfigurationTracer.TraceDebug <UserConfigurationName>(0L, "UserConfiguration::GetIgnoringCache. Hit Query. ConfigName = {0}.", configurationName);
                list = UserConfiguration.QueryConfigurations(folder, sorts, configurationName, UserConfigurationSearchFlags.FullString, 2, columns);
            }
            catch (InvalidOperationException innerException)
            {
                throw new InvalidOperationException(ServerStrings.ExCannotQueryAssociatedTable, innerException);
            }
            if (list.Count <= 0)
            {
                ExTraceGlobals.StorageTracer.TraceError <UserConfigurationName, UserConfigurationTypes>(0L, "UserConfiguration::GetIgnoringCache. The configuration object was not found. Name = {0}, type = {1}.", configurationName, freefetchType);
                throw new ObjectNotFoundException(ServerStrings.ExConfigurationNotFound(configurationName.Name));
            }
            ExTraceGlobals.UserConfigurationTracer.TraceDebug <UserConfigurationName>(0L, "UserConfiguration::GetIgnoringCache. Find the config item and build user config object from it. ConfigName = {0}.", configurationName);
            bool flag = false;
            UserConfiguration result2;

            try
            {
                userConfiguration = UserConfiguration.BuildConfigurationFromQueryItem(folder, list[0], (freefetchType & UserConfigurationTypes.Dictionary) > (UserConfigurationTypes)0);
                if (list.Count > 1)
                {
                    ExTraceGlobals.UserConfigurationTracer.TraceDebug <UserConfigurationName>(0L, "UserConfiguration::GetIgnoringCache. Found duplicate items. Conflict resolution. ConfigName = {0}.", configurationName);
                    List <VersionedId> list2 = new List <VersionedId>();
                    list = UserConfiguration.QueryConfigurations(folder, sorts, configurationName, UserConfigurationSearchFlags.FullString, 100, new PropertyDefinition[0]);
                    for (int i = 1; i < list.Count; i++)
                    {
                        list2.Add((VersionedId)list[i][InternalSchema.ItemId]);
                    }
                    if (list2.Count > 0)
                    {
                        AggregateOperationResult result = folder.Session.Delete(DeleteItemFlags.HardDelete, list2.ToArray());
                        UserConfiguration.CheckOperationResults(result, "DeleteDuplicates");
                    }
                }
                flag    = true;
                result2 = userConfiguration;
            }
            finally
            {
                if (!flag && userConfiguration != null)
                {
                    userConfiguration.Dispose();
                }
            }
            return(result2);
        }
Пример #27
0
 internal Notification(NotificationType type)
 {
     EnumValidator.AssertValid <NotificationType>(type);
     this.type       = type;
     this.createTime = Stopwatch.GetTimestamp();
 }
Пример #28
0
 public static void LogAuditOpticsEntry(AuditingOpticsLoggerType loggerType, List <KeyValuePair <string, object> > customData)
 {
     EnumValidator.AssertValid <AuditingOpticsLoggerType>(loggerType);
     AuditingOpticsLogger.GetInstance(loggerType).InternalLogRow(customData);
 }
Пример #29
0
        internal bool IsEventRelevant(Guid mailboxGuid, MapiEventTypeFlags mapiEventType, ObjectType mapiObjectType, MapiEventFlags mapiEventFlags, MapiExtendedEventFlags mapiExtendedEventFlags, byte[] entryId, byte[] parentEntryId, byte[] oldParentEntryId, string messageClass, string containerClass)
        {
            EnumValidator.AssertValid <ObjectType>(mapiObjectType);
            EnumValidator.AssertValid <MapiEventTypeFlags>(mapiEventType);
            if (mailboxGuid != this.mailboxGuid)
            {
                return(false);
            }
            if (this.condition.EventType != EventType.None && ((this.condition.EventType & EventType.FreeBusyChanged) != EventType.FreeBusyChanged || !EventSink.HasFreeBusyChanged(messageClass, mapiEventType, mapiExtendedEventFlags)) && (mapiEventType & this.mapiEventTypes) == (MapiEventTypeFlags)0)
            {
                return(false);
            }
            if (this.condition.ObjectType != EventObjectType.None)
            {
                switch (this.condition.ObjectType)
                {
                case EventObjectType.Item:
                    if (mapiObjectType != ObjectType.MAPI_MESSAGE)
                    {
                        return(false);
                    }
                    break;

                case EventObjectType.Folder:
                    if (mapiObjectType != ObjectType.MAPI_FOLDER)
                    {
                        return(false);
                    }
                    break;
                }
            }
            if (this.condition.EventSubtree != EventSubtreeFlag.All)
            {
                if (this.condition.EventSubtree == EventSubtreeFlag.NonIPMSubtree && (mapiExtendedEventFlags & MapiExtendedEventFlags.NonIPMFolder) != MapiExtendedEventFlags.NonIPMFolder)
                {
                    return(false);
                }
                if (this.condition.EventSubtree == EventSubtreeFlag.IPMSubtree && (mapiExtendedEventFlags & (MapiExtendedEventFlags)(-2147483648)) != (MapiExtendedEventFlags)(-2147483648))
                {
                    return(false);
                }
            }
            if (this.condition.EventFlags != EventFlags.None)
            {
                EventFlags eventFlags = ((mapiExtendedEventFlags & MapiExtendedEventFlags.NoReminderPropertyModified) == MapiExtendedEventFlags.NoReminderPropertyModified) ? EventFlags.None : EventFlags.ReminderPropertiesModified;
                if ((mapiExtendedEventFlags & MapiExtendedEventFlags.TimerEventFired) == MapiExtendedEventFlags.TimerEventFired)
                {
                    eventFlags |= EventFlags.TimerEventFired;
                }
                if ((eventFlags & this.condition.EventFlags) != this.condition.EventFlags)
                {
                    return(false);
                }
            }
            if ((mapiEventFlags & MapiEventFlags.SoftDeleted) == MapiEventFlags.SoftDeleted)
            {
                return(false);
            }
            if (this.parentEntryIds.Length != 0 || this.objectEntryIds.Length != 0)
            {
                bool flag  = false;
                bool flag2 = (mapiEventType & MapiEventTypeFlags.ObjectMoved) == MapiEventTypeFlags.ObjectMoved;
                IEqualityComparer <byte[]> comparer = ArrayComparer <byte> .Comparer;
                foreach (byte[] x in this.parentEntryIds)
                {
                    if (comparer.Equals(x, parentEntryId))
                    {
                        flag = true;
                        break;
                    }
                    if (flag2 && comparer.Equals(x, oldParentEntryId))
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    foreach (byte[] x2 in this.objectEntryIds)
                    {
                        if (comparer.Equals(x2, entryId))
                        {
                            flag = true;
                            break;
                        }
                    }
                    if (!flag)
                    {
                        return(false);
                    }
                }
            }
            if (this.considerClassNames)
            {
                string text;
                if (mapiObjectType == ObjectType.MAPI_FOLDER)
                {
                    text = containerClass;
                }
                else
                {
                    text = messageClass;
                }
                foreach (string b in this.expectedClassNameExactMatches)
                {
                    if (text == b)
                    {
                        return(true);
                    }
                }
                foreach (string value in this.expectedClassNamePrefixes)
                {
                    if (text.StartsWith(value))
                    {
                        return(true);
                    }
                }
                return(false);
            }
            return(true);
        }