public void Save(TenantInfo tenantInfo) { try { using (MailboxSession mailboxSession = MailboxSession.OpenAsAdmin(this.SyncMailboxPrincipal, CultureInfo.InvariantCulture, "Client=UnifiedPolicy;Action=CommitChanges;Interactive=False")) { using (UserConfiguration mailboxConfiguration = UserConfigurationHelper.GetMailboxConfiguration(mailboxSession, "TenantInfoConfigurations", UserConfigurationTypes.Stream, true)) { using (Stream stream = mailboxConfiguration.GetStream()) { BinaryFormatter binaryFormatter = ExchangeBinaryFormatterFactory.CreateBinaryFormatter(null); binaryFormatter.Serialize(stream, tenantInfo); } mailboxConfiguration.Save(); } } } catch (StoragePermanentException innerException) { throw new SyncAgentPermanentException("TenantInfoProvider.Save failed with StoragePermanentException", innerException); } catch (StorageTransientException innerException2) { throw new SyncAgentTransientException("TenantInfoProvider.Save failed with StorageTransientException", innerException2); } catch (IOException innerException3) { throw new SyncAgentTransientException("TenantInfoProvider.Save failed with IOException", innerException3); } }
protected override void InitializeSyncMetadata() { if (this.syncMetadata == null) { this.syncMetadata = UserConfigurationHelper.GetMailboxConfiguration(this.mailboxSession, "SiteSynchronizerConfigurations", UserConfigurationTypes.Dictionary, true); } }
public void SetRecommendedGroups(MailboxSession session, RecommendedGroupsInfo groupsInfo, int version, Action <string> traceDelegate, Action <Exception> traceErrorDelegate) { ArgumentValidator.ThrowIfNull("session", session); ArgumentValidator.ThrowIfNull("traceDelegate", traceDelegate); ArgumentValidator.ThrowIfNull("traceErrorDelegate", traceErrorDelegate); string text = string.Format("{0}.{1}", "Inference.RecommendedGroups", version); try { traceDelegate(string.Format("Writing out recommended groups to {0}", text)); using (UserConfiguration folderConfiguration = UserConfigurationHelper.GetFolderConfiguration(session, session.GetDefaultFolderId(DefaultFolderType.Inbox), text, UserConfigurationTypes.Stream, true, false)) { if (folderConfiguration != null) { using (Stream stream = folderConfiguration.GetStream()) { this.WriteItem(stream, groupsInfo); folderConfiguration.Save(); } } } } catch (SerializationException obj) { traceErrorDelegate(obj); } }
public override void Delete(MailboxStoreTypeProvider session) { using (UserConfiguration mailboxConfiguration = UserConfigurationHelper.GetMailboxConfiguration(session.MailboxSession, MRSRequest.GetName(this.RequestGuid), UserConfigurationTypes.Dictionary, false)) { if (mailboxConfiguration == null) { return; } } UserConfigurationHelper.DeleteMailboxConfiguration(session.MailboxSession, MRSRequest.GetName(this.RequestGuid)); }
public override void Delete(MailboxStoreTypeProvider session) { using (UserConfiguration mailboxConfiguration = UserConfigurationHelper.GetMailboxConfiguration(session.MailboxSession, "AggregatedAccount", UserConfigurationTypes.Dictionary, false)) { if (mailboxConfiguration == null) { return; } } UserConfigurationHelper.DeleteMailboxConfiguration(session.MailboxSession, "AggregatedAccount"); }
protected override TeamMailboxSyncInfo CreateOnCacheMiss(TeamMailboxSyncId key, ref bool shouldAdd) { IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(key.DomainController, true, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(key.OrgId), 105, "CreateOnCacheMiss", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\LinkedFolder\\TeamMailboxSyncInfoCache.cs"); ADRecipient adrecipient = tenantOrRootOrgRecipientSession.FindByExchangeGuid(key.MailboxGuid); ADUser aduser = adrecipient as ADUser; if (aduser == null) { return(null); } TeamMailboxLifecycleState teamMailboxLifecycleState = TeamMailboxLifecycleState.Active; if (TeamMailbox.IsPendingDeleteSiteMailbox(aduser)) { teamMailboxLifecycleState = TeamMailboxLifecycleState.PendingDelete; } else if (aduser.SharePointUrl == null) { teamMailboxLifecycleState = TeamMailboxLifecycleState.Unlinked; } ExchangePrincipal exchangePrincipal = null; try { exchangePrincipal = ExchangePrincipal.FromMailboxGuid(ADSessionSettings.FromOrganizationIdWithoutRbacScopesServiceOnly(key.OrgId), key.MailboxGuid, key.DomainController); } catch (ObjectNotFoundException) { return(null); } TeamMailboxSyncInfo result; using (DisposeGuard disposeGuard = default(DisposeGuard)) { MailboxSession mailboxSession = null; UserConfiguration userConfiguration = null; if (teamMailboxLifecycleState == TeamMailboxLifecycleState.Active) { mailboxSession = MailboxSession.OpenAsAdmin(exchangePrincipal, CultureInfo.InvariantCulture, "Client=TeamMailbox;Action=CommitChanges;Interactive=False"); disposeGuard.Add <MailboxSession>(mailboxSession); if (!string.Equals(mailboxSession.MailboxOwner.MailboxInfo.Location.ServerFqdn, TeamMailboxSyncInfoCache.LocalServerFqdn, StringComparison.OrdinalIgnoreCase)) { throw new WrongServerException(new LocalizedString(string.Format("Non-local XSO MailboxSession not allowed for TeamMailboxSync. TeamMailbox Name: {0}, MailboxGuid {1}, ServerFqdn {2}", mailboxSession.MailboxOwner.MailboxInfo.DisplayName, mailboxSession.MailboxOwner.MailboxInfo.MailboxGuid, mailboxSession.MailboxOwner.MailboxInfo.Location.ServerFqdn))); } userConfiguration = UserConfigurationHelper.GetMailboxConfiguration(mailboxSession, this.syncLogConfigurationName, UserConfigurationTypes.Stream, true); disposeGuard.Add <UserConfiguration>(userConfiguration); } TeamMailbox teamMailbox = TeamMailbox.FromDataObject(aduser); TeamMailboxSyncInfo teamMailboxSyncInfo = new TeamMailboxSyncInfo(key.MailboxGuid, teamMailboxLifecycleState, mailboxSession, exchangePrincipal, teamMailbox.DisplayName, teamMailbox.WebCollectionUrl, teamMailbox.WebId, (aduser.SharePointUrl != null) ? aduser.SharePointUrl.AbsoluteUri : null, (teamMailboxLifecycleState == TeamMailboxLifecycleState.Active) ? this.resourceMonitorFactory.Create(exchangePrincipal.MailboxInfo.MailboxDatabase.ObjectGuid) : null, userConfiguration); disposeGuard.Success(); result = teamMailboxSyncInfo; } return(result); }
protected override void InternalDelete(ConfigurableObject instance) { VersionedXmlConfigurationObject versionedXmlConfigurationObject = (VersionedXmlConfigurationObject)instance; using (UserConfiguration mailboxConfiguration = UserConfigurationHelper.GetMailboxConfiguration(base.MailboxSession, versionedXmlConfigurationObject.UserConfigurationName, UserConfigurationTypes.XML, false)) { if (mailboxConfiguration == null) { return; } } UserConfigurationHelper.DeleteMailboxConfiguration(base.MailboxSession, versionedXmlConfigurationObject.UserConfigurationName); }
protected override void InternalSave(ConfigurableObject instance) { VersionedXmlConfigurationObject versionedXmlConfigurationObject = (VersionedXmlConfigurationObject)instance; using (UserConfiguration mailboxConfiguration = UserConfigurationHelper.GetMailboxConfiguration(base.MailboxSession, versionedXmlConfigurationObject.UserConfigurationName, UserConfigurationTypes.XML, true)) { using (Stream xmlStream = mailboxConfiguration.GetXmlStream()) { VersionedXmlBase.Serialize(xmlStream, (VersionedXmlBase)versionedXmlConfigurationObject[versionedXmlConfigurationObject.RawVersionedXmlPropertyDefinition]); } mailboxConfiguration.Save(); } instance.ResetChangeTracking(); }
public TenantInfo Load() { TenantInfo result; try { using (MailboxSession mailboxSession = MailboxSession.OpenAsAdmin(this.SyncMailboxPrincipal, CultureInfo.InvariantCulture, "Client=UnifiedPolicy;Action=CommitChanges;Interactive=False")) { using (UserConfiguration mailboxConfiguration = UserConfigurationHelper.GetMailboxConfiguration(mailboxSession, "TenantInfoConfigurations", UserConfigurationTypes.Stream, false)) { if (mailboxConfiguration == null) { result = null; } else { using (Stream stream = mailboxConfiguration.GetStream()) { if (stream == null || stream.Length == 0L) { result = null; } else { BinaryFormatter binaryFormatter = ExchangeBinaryFormatterFactory.CreateBinaryFormatter(null); TenantInfo tenantInfo = (TenantInfo)binaryFormatter.Deserialize(stream); result = tenantInfo; } } } } } } catch (StoragePermanentException innerException) { throw new SyncAgentPermanentException("TenantInfoProvider.Load failed with StoragePermanentException", innerException); } catch (StorageTransientException innerException2) { throw new SyncAgentTransientException("TenantInfoProvider.Load failed with StorageTransientException", innerException2); } catch (IOException innerException3) { throw new SyncAgentTransientException("TenantInfoProvider.Load failed with IOException", innerException3); } return(result); }
public IReadOnlyList <IRecommendedGroupInfo> GetRecommendedGroups(MailboxSession session, Action <string> traceDelegate, Action <Exception> traceErrorDelegate) { ArgumentValidator.ThrowIfNull("session", session); ArgumentValidator.ThrowIfNull("traceDelegate", traceDelegate); ArgumentValidator.ThrowIfNull("traceErrorDelegate", traceErrorDelegate); IReadOnlyList <IRecommendedGroupInfo> result = null; Exception ex = null; string text = string.Format("{0}.{1}", "Inference.RecommendedGroups", this.modelVersionSelector.GetModelVersionToAccessRecommendedGroups()); try { traceDelegate(string.Format("Loading recommended groups from {0}", text)); using (UserConfiguration folderConfiguration = UserConfigurationHelper.GetFolderConfiguration(session, session.GetDefaultFolderId(DefaultFolderType.Inbox), text, UserConfigurationTypes.Stream, false, false)) { if (folderConfiguration != null) { using (Stream stream = folderConfiguration.GetStream()) { RecommendedGroupsInfo recommendedGroupsInfo = this.ReadItem(stream); if (recommendedGroupsInfo != null) { result = recommendedGroupsInfo.RecommendedGroups; } } } } } catch (ObjectNotFoundException ex2) { ex = ex2; } catch (CorruptDataException ex3) { ex = ex3; } catch (SerializationException ex4) { ex = ex4; } if (ex != null) { traceErrorDelegate(ex); } return(result); }
// Token: 0x06000E52 RID: 3666 RVA: 0x00056550 File Offset: 0x00054750 private UserConfiguration GetPublishingConfiguration(MailboxSession mailboxSession, StoreId folderId) { UserConfiguration userConfiguration = null; try { userConfiguration = UserConfigurationHelper.GetPublishingConfiguration(mailboxSession, folderId, false); if (userConfiguration == null) { SharingPolicyAssistant.Tracer.TraceDebug <IExchangePrincipal>((long)this.GetHashCode(), "{0}: User configuration doesn't exist.", mailboxSession.MailboxOwner); } } catch (CorruptDataException arg) { SharingPolicyAssistant.Tracer.TraceError <IExchangePrincipal, CorruptDataException>((long)this.GetHashCode(), "{0}: User configuration is corrupt. Exception = {1}", mailboxSession.MailboxOwner, arg); } return(userConfiguration); }
public override void Delete(MailboxStoreTypeProvider session) { AggregatedAccountListConfiguration aggregatedAccountListConfiguration = this.Read(session, null) as AggregatedAccountListConfiguration; if (aggregatedAccountListConfiguration != null) { this.AggregatedAccountList = aggregatedAccountListConfiguration.AggregatedAccountList; } if (this.AggregatedAccountList != null) { this.AggregatedAccountList = this.AggregatedAccountList.FindAll((AggregatedAccountInfo account) => account.RequestGuid != this.RequestGuid); } if (this.AggregatedAccountList == null || this.AggregatedAccountList.Count == 0) { UserConfigurationHelper.DeleteMailboxConfiguration(session.MailboxSession, "AggregatedAccountList"); return; } this.UpdateFAI(session); }
private bool TryRemovePerExtensionFai(string extensionId, string version) { StoreObjectId extensionFolderId = ExtensionPackageManager.GetExtensionFolderId(base.MailboxSession); bool result; using (UserConfiguration folderConfiguration = UserConfigurationHelper.GetFolderConfiguration(base.MailboxSession, extensionFolderId, ExtensionPackageManager.GetFaiName(extensionId, version), UserConfigurationTypes.Stream | UserConfigurationTypes.XML | UserConfigurationTypes.Dictionary, false, false)) { if (folderConfiguration != null && OperationResult.Succeeded != base.MailboxSession.UserConfigurationManager.DeleteFolderConfigurations(extensionFolderId, new string[] { ExtensionPackageManager.GetFaiName(extensionId, version) })) { result = false; } else { result = true; } } return(result); }
public static ExTimeZone GetUserTimeZone(MailboxSession mailboxSession) { ExTimeZone result = null; UserConfiguration mailboxConfiguration = UserConfigurationHelper.GetMailboxConfiguration(mailboxSession, "OWA.UserOptions", UserConfigurationTypes.Dictionary, false); if (mailboxConfiguration == null) { ExTraceGlobals.StorageTracer.TraceDebug <IExchangePrincipal>(0L, "{0}: UserOption doesn't exist.", mailboxSession.MailboxOwner); } else { using (mailboxConfiguration) { IDictionary dictionary = null; try { dictionary = mailboxConfiguration.GetDictionary(); } catch (CorruptDataException) { ExTraceGlobals.StorageTracer.TraceError <IExchangePrincipal>(0L, "{0}: Dictionary exists but is corrupt.", mailboxSession.MailboxOwner); } catch (InvalidOperationException) { ExTraceGlobals.StorageTracer.TraceError <IExchangePrincipal>(0L, "{0}: Dictionary is invalid.", mailboxSession.MailboxOwner); } if (dictionary != null) { string text = dictionary[MailboxRegionalConfigurationSchema.TimeZone.Name] as string; ExTraceGlobals.StorageTracer.TraceDebug <IExchangePrincipal, string>(0L, "{0}: Get timezone from dictionary of configuration. KeyName = {1}", mailboxSession.MailboxOwner, text); if (string.IsNullOrEmpty(text) || !ExTimeZoneEnumerator.Instance.TryGetTimeZoneByName(text, out result)) { ExTraceGlobals.StorageTracer.TraceError <IExchangePrincipal, string>(0L, "{0}: The KeyName of TimeZone is invalid. KeyName = {1}", mailboxSession.MailboxOwner, text); } } } } return(result); }
// Token: 0x06001665 RID: 5733 RVA: 0x0007E184 File Offset: 0x0007C384 private System.DayOfWeek LoadFirstDayOfWeek() { ExTraceGlobals.HeuristicsTracer.TraceFunction(0L, "ReminderTimeCalculatorContext.LoadFirstDayOfWeek"); using (IReadableUserConfiguration readOnlyMailboxConfiguration = UserConfigurationHelper.GetReadOnlyMailboxConfiguration(this.session as MailboxSession, "OWA.UserOptions", UserConfigurationTypes.Dictionary, false)) { if (readOnlyMailboxConfiguration != null) { IDictionary dictionary = readOnlyMailboxConfiguration.GetDictionary(); object obj = dictionary[MailboxCalendarConfigurationSchema.WeekStartDay.Name]; if (obj != null) { ExTraceGlobals.HeuristicsTracer.TraceDebug(0L, "Found first day of week: {0}", new object[] { obj }); return((System.DayOfWeek)obj); } ExTraceGlobals.HeuristicsTracer.TraceDebug(0L, "WeekStartDay is null on config object"); } } ExTraceGlobals.HeuristicsTracer.TraceDebug(0L, "Unable to determine first day of week"); return(System.DayOfWeek.Sunday); }
// Token: 0x06001502 RID: 5378 RVA: 0x00078438 File Offset: 0x00076638 protected override void InvokeInternal(InvokeArgs invokeArgs, List <KeyValuePair <string, object> > customDataToLog) { MailboxSession mailboxSession = invokeArgs.StoreSession as MailboxSession; if (mailboxSession == null) { return; } LoggingContext loggingContext = null; try { using (DisposeGuard disposeGuard = default(DisposeGuard)) { loggingContext = new LoggingContext(mailboxSession.MailboxGuid, mailboxSession.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString(), string.Empty, null); UserConfiguration mailboxConfiguration = UserConfigurationHelper.GetMailboxConfiguration(mailboxSession, "SiteMailboxAssistantCycleLog", UserConfigurationTypes.Stream, true); disposeGuard.Add <UserConfiguration>(mailboxConfiguration); Stream stream = mailboxConfiguration.GetStream(); disposeGuard.Add <Stream>(stream); UserConfiguration mailboxConfiguration2 = UserConfigurationHelper.GetMailboxConfiguration(mailboxSession, "SiteMailboxAssistantConfigurations", UserConfigurationTypes.Dictionary, true); disposeGuard.Add <UserConfiguration>(mailboxConfiguration2); loggingContext.LoggingStream = stream; SiteMailboxAssistant.EnqueueTeamMailboxSyncRequest(mailboxSession, QueueType.TeamMailboxMaintenanceSync, loggingContext); SiteMailboxAssistant.EnqueueTeamMailboxSyncRequest(mailboxSession, QueueType.TeamMailboxMembershipSync, loggingContext); SiteMailboxAssistant.EnqueueTeamMailboxSyncRequest(mailboxSession, QueueType.TeamMailboxDocumentSync, loggingContext); } } catch (StoragePermanentException exception) { ProtocolLog.LogError(ProtocolLog.Component.Assistant, loggingContext, string.Format("Failed with StoragePermanentException for site mailbox:{0}", mailboxSession.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString()), exception); } catch (StorageTransientException exception2) { ProtocolLog.LogError(ProtocolLog.Component.Assistant, loggingContext, string.Format("Failed with StorageTransientException for site mailbox:{0}", mailboxSession.MailboxOwner.MailboxInfo.PrimarySmtpAddress.ToString()), exception2); } }
protected override void InternalSave(ConfigurableObject instance) { if (instance == null) { throw new ArgumentNullException("instance"); } MailboxCalendarFolder mailboxCalendarFolder = instance as MailboxCalendarFolder; if (mailboxCalendarFolder == null) { throw new NotSupportedException("Save: " + instance.GetType().FullName); } if (mailboxCalendarFolder.PublishEnabled) { SharingPolicy sharingPolicy = DirectoryHelper.ReadSharingPolicy(base.MailboxSession.MailboxOwner.MailboxInfo.MailboxGuid, base.MailboxSession.MailboxOwner.MailboxInfo.IsArchive, base.MailboxSession.GetADRecipientSession(true, ConsistencyMode.IgnoreInvalid)); if (sharingPolicy == null || !sharingPolicy.Enabled || !sharingPolicy.IsAllowedForAnonymousCalendarSharing()) { throw new NotAllowedPublishingByPolicyException(); } SharingPolicyAction allowedForAnonymousCalendarSharing = sharingPolicy.GetAllowedForAnonymousCalendarSharing(); int maxAllowed = PolicyAllowedDetailLevel.GetMaxAllowed(allowedForAnonymousCalendarSharing); if (mailboxCalendarFolder.DetailLevel > (DetailLevelEnumType)maxAllowed) { throw new NotAllowedPublishingByPolicyException(mailboxCalendarFolder.DetailLevel, (DetailLevelEnumType)maxAllowed); } } MailboxFolderId mailboxFolderId = mailboxCalendarFolder.MailboxFolderId; StoreObjectId folderId = mailboxFolderId.StoreObjectIdValue ?? base.ResolveStoreObjectIdFromFolderPath(mailboxFolderId.MailboxFolderPath); if (folderId == null || folderId.ObjectType != StoreObjectType.CalendarFolder) { throw new CantFindCalendarFolderException(mailboxFolderId); } using (CalendarFolder calendarFolder = CalendarFolder.Bind(base.MailboxSession, folderId)) { ExtendedFolderFlags?valueAsNullable = calendarFolder.GetValueAsNullable <ExtendedFolderFlags>(FolderSchema.ExtendedFolderFlags); if (valueAsNullable != null && (valueAsNullable.Value & ExtendedFolderFlags.PersonalShare) != (ExtendedFolderFlags)0) { throw new CannotShareFolderException(ServerStrings.CannotShareOtherPersonalFolder); } this.SaveSharingAnonymous(mailboxCalendarFolder, folderId); if (!mailboxCalendarFolder.PublishEnabled) { mailboxCalendarFolder.PublishedCalendarUrl = null; mailboxCalendarFolder.PublishedICalUrl = null; } UserConfigurationDictionaryHelper.Save(mailboxCalendarFolder, MailboxCalendarFolder.CalendarFolderConfigurationProperties, (bool createIfNonexisting) => UserConfigurationHelper.GetPublishingConfiguration(this.MailboxSession, folderId, createIfNonexisting)); if (MailboxCalendarFolderDataProvider.UpdateExtendedFolderFlags(mailboxCalendarFolder, calendarFolder)) { calendarFolder.Save(); } } }
protected override IEnumerable <T> InternalFindPaged <T>(QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy, int pageSize) { if (sortBy != null) { throw new NotSupportedException("sortBy"); } if (rootId == null) { throw new NotSupportedException("rootId must be specified"); } if (!(rootId is MailboxFolderId)) { throw new NotSupportedException("rootId: " + rootId.GetType().FullName); } if (!typeof(MailboxCalendarFolder).GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo())) { throw new NotSupportedException("FindPaged: " + typeof(T).FullName); } MailboxFolderId mailboxFolderId = (MailboxFolderId)rootId; StoreObjectId folderId = mailboxFolderId.StoreObjectIdValue ?? base.ResolveStoreObjectIdFromFolderPath(mailboxFolderId.MailboxFolderPath); if (folderId == null) { throw new CantFindCalendarFolderException(mailboxFolderId); } using (Folder folder = Folder.Bind(base.MailboxSession, folderId)) { if (!StringComparer.OrdinalIgnoreCase.Equals(folder.ClassName, "IPF.Appointment")) { throw new CantFindCalendarFolderException(mailboxFolderId); } } MailboxCalendarFolder mailboxCalendarFolder = (MailboxCalendarFolder)((object)((default(T) == null) ? Activator.CreateInstance <T>() : default(T))); mailboxCalendarFolder.MailboxFolderId = mailboxFolderId; UserConfigurationDictionaryHelper.Fill(mailboxCalendarFolder, MailboxCalendarFolder.CalendarFolderConfigurationProperties, (bool createIfNonexisting) => UserConfigurationHelper.GetPublishingConfiguration(this.MailboxSession, folderId, createIfNonexisting)); yield return((T)((object)mailboxCalendarFolder)); yield break; }
private TeamMailboxDiagnosticsInfo GetOneTeamMailboxDiagnosticsInfo(KeyValuePair <ADUser, ExchangePrincipal> entry) { TeamMailboxDiagnosticsInfo teamMailboxDiagnosticsInfo = new TeamMailboxDiagnosticsInfo(entry.Value.MailboxInfo.DisplayName); MultiValuedProperty <SyncInfo> multiValuedProperty = new MultiValuedProperty <SyncInfo>(); bool flag = false; bool flag2 = false; bool flag3 = false; TeamMailboxDiagnosticsInfo result; using (MailboxSession mailboxSession = MailboxSession.OpenAsAdmin(entry.Value, CultureInfo.InvariantCulture, "Client=TeamMailbox;Action=GetDiagnostics;Interactive=False")) { using (UserConfiguration mailboxConfiguration = UserConfigurationHelper.GetMailboxConfiguration(mailboxSession, "SiteSynchronizerConfigurations", UserConfigurationTypes.Dictionary, false)) { if (mailboxConfiguration != null) { teamMailboxDiagnosticsInfo.HierarchySyncInfo = GetSiteMailboxDiagnostics.GetSyncInfoFromMetadata(entry.Value.MailboxInfo.DisplayName, (entry.Key.SharePointUrl != null) ? entry.Key.SharePointUrl.AbsoluteUri : string.Empty, mailboxConfiguration); if (!string.IsNullOrEmpty(teamMailboxDiagnosticsInfo.HierarchySyncInfo.LastSyncFailure)) { flag = true; } } } using (Folder folder = Folder.Bind(mailboxSession, DefaultFolderType.Root)) { using (QueryResult queryResult = folder.FolderQuery(FolderQueryFlags.None, new ExistsFilter(FolderSchema.LinkedId), null, new PropertyDefinition[] { FolderSchema.Id, FolderSchema.DisplayName, FolderSchema.LinkedUrl })) { object[][] array = null; do { array = queryResult.GetRows(10000); for (int i = 0; i < array.Length; i++) { StoreObjectId objectId = ((VersionedId)array[i][0]).ObjectId; string displayName = array[i][1] as string; string url = array[i][2] as string; using (UserConfiguration folderConfiguration = UserConfigurationHelper.GetFolderConfiguration(mailboxSession, objectId, "DocumentLibSynchronizerConfigurations", UserConfigurationTypes.Dictionary, false, false)) { if (folderConfiguration != null) { SyncInfo syncInfoFromMetadata = GetSiteMailboxDiagnostics.GetSyncInfoFromMetadata(displayName, url, folderConfiguration); multiValuedProperty.Add(syncInfoFromMetadata); if (!string.IsNullOrEmpty(syncInfoFromMetadata.LastSyncFailure)) { flag = true; } } } } }while (array.Length != 0); } } teamMailboxDiagnosticsInfo.DocLibSyncInfos = multiValuedProperty; using (UserConfiguration mailboxConfiguration2 = UserConfigurationHelper.GetMailboxConfiguration(mailboxSession, "TeamMailboxDocumentLastSyncCycleLog", UserConfigurationTypes.Stream, false)) { if (mailboxConfiguration2 != null) { using (Stream stream = mailboxConfiguration2.GetStream()) { byte[] array2 = new byte[stream.Length]; stream.Read(array2, 0, array2.Length); teamMailboxDiagnosticsInfo.LastDocumentSyncCycleLog = Encoding.ASCII.GetString(array2); } } } using (UserConfiguration mailboxConfiguration3 = UserConfigurationHelper.GetMailboxConfiguration(mailboxSession, "MembershipSynchronizerConfigurations", UserConfigurationTypes.Dictionary, false)) { if (mailboxConfiguration3 != null) { teamMailboxDiagnosticsInfo.MembershipSyncInfo = GetSiteMailboxDiagnostics.GetSyncInfoFromMetadata(entry.Value.MailboxInfo.DisplayName, (entry.Key.SharePointUrl != null) ? entry.Key.SharePointUrl.AbsoluteUri : string.Empty, mailboxConfiguration3); if (!string.IsNullOrEmpty(teamMailboxDiagnosticsInfo.MembershipSyncInfo.LastSyncFailure)) { flag2 = true; } } } using (UserConfiguration mailboxConfiguration4 = UserConfigurationHelper.GetMailboxConfiguration(mailboxSession, "TeamMailboxMembershipLastSyncCycleLog", UserConfigurationTypes.Stream, false)) { if (mailboxConfiguration4 != null) { using (Stream stream2 = mailboxConfiguration4.GetStream()) { byte[] array3 = new byte[stream2.Length]; stream2.Read(array3, 0, array3.Length); teamMailboxDiagnosticsInfo.LastMembershipSyncCycleLog = Encoding.ASCII.GetString(array3); } } } using (UserConfiguration mailboxConfiguration5 = UserConfigurationHelper.GetMailboxConfiguration(mailboxSession, "MaintenanceSynchronizerConfigurations", UserConfigurationTypes.Dictionary, false)) { if (mailboxConfiguration5 != null) { teamMailboxDiagnosticsInfo.MaintenanceSyncInfo = GetSiteMailboxDiagnostics.GetSyncInfoFromMetadata(entry.Value.MailboxInfo.DisplayName, (entry.Key.SharePointUrl != null) ? entry.Key.SharePointUrl.AbsoluteUri : string.Empty, mailboxConfiguration5); if (!string.IsNullOrEmpty(teamMailboxDiagnosticsInfo.MaintenanceSyncInfo.LastSyncFailure)) { flag3 = true; } } } using (UserConfiguration mailboxConfiguration6 = UserConfigurationHelper.GetMailboxConfiguration(mailboxSession, "TeamMailboxMaintenanceLastSyncCycleLog", UserConfigurationTypes.Stream, false)) { if (mailboxConfiguration6 != null) { using (Stream stream3 = mailboxConfiguration6.GetStream()) { byte[] array4 = new byte[stream3.Length]; stream3.Read(array4, 0, array4.Length); teamMailboxDiagnosticsInfo.LastMaintenanceSyncCycleLog = Encoding.ASCII.GetString(array4); } } } if (!flag && !flag2 && !flag3) { teamMailboxDiagnosticsInfo.Status = TeamMailboxSyncStatus.Succeeded; } else if (flag && !flag2 && !flag3) { teamMailboxDiagnosticsInfo.Status = TeamMailboxSyncStatus.DocumentSyncFailureOnly; } else if (!flag && flag2 && !flag3) { teamMailboxDiagnosticsInfo.Status = TeamMailboxSyncStatus.MembershipSyncFailureOnly; } else if (!flag && !flag2 && flag3) { teamMailboxDiagnosticsInfo.Status = TeamMailboxSyncStatus.MaintenanceSyncFailureOnly; } else if (flag && flag2 && !flag3) { teamMailboxDiagnosticsInfo.Status = TeamMailboxSyncStatus.DocumentAndMembershipSyncFailure; } else if (!flag && flag2 && flag3) { teamMailboxDiagnosticsInfo.Status = TeamMailboxSyncStatus.MembershipAndMaintenanceSyncFailure; } else if (flag && !flag2 && flag3) { teamMailboxDiagnosticsInfo.Status = TeamMailboxSyncStatus.DocumentAndMaintenanceSyncFailure; } else { teamMailboxDiagnosticsInfo.Status = TeamMailboxSyncStatus.Failed; } result = teamMailboxDiagnosticsInfo; } return(result); }
protected override IEnumerable <T> InternalFindPaged <T>(QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy, int pageSize) { if (filter != null && !(filter is FalseFilter)) { throw new NotSupportedException("filter"); } if (rootId != null && rootId is ADObjectId && !ADObjectId.Equals((ADObjectId)rootId, base.MailboxSession.MailboxOwner.ObjectId)) { throw new NotSupportedException("rootId"); } if (!typeof(VersionedXmlConfigurationObject).GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo())) { throw new NotSupportedException("FindPaged: " + typeof(T).FullName); } VersionedXmlConfigurationObject configObject = (VersionedXmlConfigurationObject)((object)((default(T) == null) ? Activator.CreateInstance <T>() : default(T))); configObject[VersionedXmlConfigurationObjectSchema.Identity] = base.MailboxSession.MailboxOwner.ObjectId; VersionedXmlBase configXml = null; using (UserConfiguration mailboxConfiguration = UserConfigurationHelper.GetMailboxConfiguration(base.MailboxSession, configObject.UserConfigurationName, UserConfigurationTypes.XML, false)) { if (mailboxConfiguration != null) { using (Stream xmlStream = mailboxConfiguration.GetXmlStream()) { try { configXml = VersionedXmlBase.Deserialize(xmlStream); } catch (InvalidOperationException ex) { ExTraceGlobals.XsoTracer.TraceDebug <string>((long)this.GetHashCode(), "Deserialize TextMessagingSettings failed: {0}", ex.ToString()); } } } } if (configXml != null) { if (configObject.RawVersionedXmlPropertyDefinition.Type != configXml.GetType()) { throw new NotSupportedException("FindPaged: " + typeof(T).FullName); } configObject[configObject.RawVersionedXmlPropertyDefinition] = configXml; TextMessagingAccount textMessagingAccount = configObject as TextMessagingAccount; if (textMessagingAccount != null) { textMessagingAccount.NotificationPreferredCulture = base.MailboxSession.PreferedCulture; if (textMessagingAccount.CountryRegionId != null) { if (string.Equals(textMessagingAccount.CountryRegionId.TwoLetterISORegionName, "US", StringComparison.OrdinalIgnoreCase)) { textMessagingAccount.NotificationPreferredCulture = new CultureInfo("en-US"); } else if (string.Equals(textMessagingAccount.CountryRegionId.TwoLetterISORegionName, "CA", StringComparison.OrdinalIgnoreCase)) { if (textMessagingAccount.NotificationPreferredCulture != null && string.Equals(textMessagingAccount.NotificationPreferredCulture.TwoLetterISOLanguageName, "fr", StringComparison.OrdinalIgnoreCase)) { textMessagingAccount.NotificationPreferredCulture = new CultureInfo("fr-CA"); } else { textMessagingAccount.NotificationPreferredCulture = new CultureInfo("en-CA"); } } } } ValidationError[] array = configObject.Validate(); if (array != null && 0 < array.Length) { ExTraceGlobals.XsoTracer.TraceDebug <string>((long)this.GetHashCode(), "TextMessagingSettings validation failed: {0}", array[0].ToString()); configObject[configObject.RawVersionedXmlPropertyDefinition] = null; } configObject.ResetChangeTracking(); } yield return((T)((object)configObject)); yield break; }
// Token: 0x06000AFA RID: 2810 RVA: 0x0002C438 File Offset: 0x0002A638 internal override MailAppsResult GetExchangeDiagnosticsInfoData(DiagnosableParameters argument) { MailAppsResult mailAppsResult = new MailAppsResult(); string text = argument.Argument; if (!string.IsNullOrEmpty(text)) { string value = null; string text2 = ",val="; int num = text.IndexOf(text2); if (num != -1) { value = text.Substring(num + text2.Length); text = argument.Argument.Substring(0, num); } MailAppsArgument mailAppsArgument = new MailAppsArgument(text); if (mailAppsArgument.HasArgument("org") && mailAppsArgument.HasArgument("cmd")) { bool flag = false; string argument2 = mailAppsArgument.GetArgument <string>("org"); ExchangePrincipal exchangePrincipal; if (mailAppsArgument.HasArgument("usr")) { string argument3 = mailAppsArgument.GetArgument <string>("usr"); ADSessionSettings adSettings = ADSessionSettings.RootOrgOrSingleTenantFromAcceptedDomainAutoDetect(argument2); exchangePrincipal = ExchangePrincipal.FromProxyAddress(adSettings, argument3 + "@" + argument2, RemotingOptions.AllowCrossSite); } else { ADUser orgMailbox = OrgExtensionTable.GetOrgMailbox(argument2); exchangePrincipal = ExchangePrincipal.FromADUser(orgMailbox, null); flag = true; } using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(exchangePrincipal, CultureInfo.CurrentCulture, "Client=WebServices")) { using (UserConfiguration folderConfiguration = UserConfigurationHelper.GetFolderConfiguration(mailboxSession, mailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox), "ExtensionMasterTable", UserConfigurationTypes.XML, true, false)) { using (Stream xmlStream = folderConfiguration.GetXmlStream()) { if (string.Equals(mailAppsArgument.GetArgument <string>("cmd"), "set", StringComparison.OrdinalIgnoreCase) && num != -1) { xmlStream.SetLength(0L); bool flag2 = string.IsNullOrEmpty(value); if (!flag2) { using (StreamWriter streamWriter = new StreamWriter(xmlStream, Encoding.UTF8)) { streamWriter.Write(value); } } folderConfiguration.Save(); if (flag) { OrgEmptyMasterTableCache.Singleton.Update(exchangePrincipal.MailboxInfo.OrganizationId, flag2); } mailAppsResult.Message = "Raw value saved."; } else { using (StreamReader streamReader = new StreamReader(xmlStream, true)) { mailAppsResult.RawMasterTable = streamReader.ReadToEnd(); if (mailAppsArgument.HasArgument("len")) { int argument4 = mailAppsArgument.GetArgument <int>("len"); if (argument4 > 0 && argument4 < mailAppsResult.RawMasterTable.Length) { mailAppsResult.RawMasterTable = mailAppsResult.RawMasterTable.Substring(0, argument4); } } } } } } } } } return(mailAppsResult); }
private void LoadPublishedCalendarOptions() { this.publishedOptions = (MailboxCalendarFolder)UserConfigurationDictionaryHelper.Fill(new MailboxCalendarFolder(), MailboxCalendarFolder.CalendarFolderConfigurationProperties, (bool createIfNonexisting) => UserConfigurationHelper.GetPublishingConfiguration(base.MailboxSession, base.FolderId, createIfNonexisting)); if (this.publishedOptions == null) { ExTraceGlobals.SharingTracer.TraceError <string, StoreObjectId>((long)this.GetHashCode(), "{0}: Cannot find published options on folder {1}.", base.OwnerDisplayName, base.FolderId); throw new FolderNotPublishedException(); } if (!this.publishedOptions.PublishEnabled) { ExTraceGlobals.SharingTracer.TraceError <string, StoreObjectId>((long)this.GetHashCode(), "{0}: Published options indicates disabled on folder {1}.", base.OwnerDisplayName, base.FolderId); throw new FolderNotPublishedException(); } }