internal void Load(bool forceReload) { if (this.IsLoaded && !forceReload) { return; } IReadableUserConfiguration readableUserConfiguration = null; this.loadedWithProblems = false; try { try { readableUserConfiguration = this.session.UserConfigurationManager.GetReadOnlyFolderConfiguration("CategoryList", UserConfigurationTypes.XML, this.session.GetDefaultFolderId(DefaultFolderType.Calendar)); ExTraceGlobals.StorageTracer.TraceDebug((long)this.GetHashCode(), "MasterCategoryList::Load - newly loaded configurationItem"); if (this.configurationItemId != null && this.configurationItemId.Equals(readableUserConfiguration.VersionedId)) { ExTraceGlobals.StorageTracer.TraceDebug((long)this.GetHashCode(), "MasterCategoryList::Load - returning without reloading since this.configurationItemId.Equals(configurationItem.VersionedId."); return; } } catch (ObjectNotFoundException) { ExTraceGlobals.StorageTracer.TraceDebug((long)this.GetHashCode(), "MasterCategoryList::Load - ObjectNotFoundException: creating and saving a new MCL"); try { readableUserConfiguration = this.CreateMclConfiguration(); } catch (ObjectExistedException ex) { ExTraceGlobals.StorageTracer.TraceWarning <string, string>((long)this.GetHashCode(), "MclConfiguration already created. Error: {0}. Stack: {1}.", ex.Message, ex.StackTrace); readableUserConfiguration = this.session.UserConfigurationManager.GetFolderConfiguration("CategoryList", UserConfigurationTypes.XML, this.session.GetDefaultFolderId(DefaultFolderType.Calendar)); } } using (Stream xmlStream = readableUserConfiguration.GetXmlStream()) { this.Load(xmlStream); this.originalMcl = this.Clone(); this.configurationItemId = readableUserConfiguration.VersionedId; } this.isListModified = false; } finally { if (readableUserConfiguration != null) { readableUserConfiguration.Dispose(); } } }
internal static PolicyTagList GetPolicyTagListFromMailboxSession(RetentionActionType type, MailboxSession session) { StoreId defaultFolderId = session.GetDefaultFolderId(DefaultFolderType.Inbox); IReadableUserConfiguration readableUserConfiguration = null; try { readableUserConfiguration = session.UserConfigurationManager.GetReadOnlyFolderConfiguration("MRM", UserConfigurationTypes.Stream | UserConfigurationTypes.XML | UserConfigurationTypes.Dictionary, defaultFolderId); if (readableUserConfiguration != null) { using (Stream xmlStream = readableUserConfiguration.GetXmlStream()) { string sessionCultureName = null; if (session.Capabilities.CanHaveCulture) { sessionCultureName = session.PreferedCulture.Name; } return(PolicyTagList.GetPolicyTakListFromXmlStream(type, xmlStream, sessionCultureName)); } } } catch (ObjectNotFoundException) { } catch (CorruptDataException) { } finally { if (readableUserConfiguration != null) { readableUserConfiguration.Dispose(); } } return(null); }