private static bool MessageIsDraft(WacRequest wacRequest) { ADSessionSettings adsessionSettings; ExchangePrincipal exchangePrincipal = WacUtilities.GetExchangePrincipal(wacRequest, out adsessionSettings, wacRequest.WacFileRep.IsArchive); CultureInfo cultureInfo = CultureInfo.GetCultureInfo(wacRequest.CultureName); if (exchangePrincipal.RecipientTypeDetails == RecipientTypeDetails.PublicFolder) { return(false); } bool result; using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(exchangePrincipal, cultureInfo, "Client=OWA;Action=WAC")) { IdConverterDependencies converterDependencies = new IdConverterDependencies.FromRawData(false, false, null, null, wacRequest.MailboxSmtpAddress.ToString(), null, mailboxSession, null); using (AttachmentHandler.IAttachmentRetriever attachmentRetriever = AttachmentRetriever.CreateInstance(wacRequest.EwsAttachmentId, converterDependencies)) { Item rootItem = attachmentRetriever.RootItem; Attachment attachment = attachmentRetriever.Attachment; string text; string text2; result = WacUtilities.ItemIsMessageDraft(rootItem, attachment, out text, out text2); } } return(result); }
// Token: 0x06000BF7 RID: 3063 RVA: 0x00031E60 File Offset: 0x00030060 private void WriteAppStatuesToMailbox() { if (this.appStatuses.Count == 0) { return; } GetUpdates.Tracer.TraceDebug <int>(0L, "GetUpdates.ConfigAppStatus: Config app status for {0} extensions.", this.appStatuses.Count); Exception ex = InstalledExtensionTable.RunClientExtensionAction(delegate { using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(this.queryContext.ExchangePrincipal, this.queryContext.CultureInfo, this.queryContext.ClientInfoString)) { using (InstalledExtensionTable installedExtensionTable = InstalledExtensionTable.CreateInstalledExtensionTable(this.queryContext.Domain, this.queryContext.IsUserScope, this.queryContext.OrgEmptyMasterTableCache, mailboxSession)) { foreach (KeyValuePair <string, string> keyValuePair in this.appStatuses) { installedExtensionTable.ConfigureAppStatus(keyValuePair.Key, keyValuePair.Value); } installedExtensionTable.SaveXML(); } } }); if (ex != null) { GetUpdates.Tracer.TraceError <Exception>(0L, "GetUpdates.ConfigAppStatus: Config app status failed. Exception: {0}", ex); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_FailedToConfigAppStatus, null, new object[] { "ProcessUpdates", ExtensionDiagnostics.GetLoggedMailboxIdentifier(this.queryContext.ExchangePrincipal), ExtensionDiagnostics.GetLoggedExceptionString(ex) }); } }
private void LogonPrimary(ExchangePrincipal primaryEP) { using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(primaryEP, CultureInfo.InvariantCulture, "Client=Monitoring;Action=Test-ArchiveConnectivity")) { if (mailboxSession != null) { UserConfiguration userConfiguration = ElcMailboxHelper.OpenFaiMessage(mailboxSession, "MRM", false); if (userConfiguration != null) { using (Stream xmlStream = userConfiguration.GetXmlStream()) { using (StreamReader streamReader = new StreamReader(xmlStream)) { this.primaryFAI = streamReader.ReadToEnd(); } goto IL_63; } } this.primaryFAI = "No FAI found in Primary Mailbox."; IL_63: this.primaryLastProcessedTime = this.ReadMailboxTableProperties(mailboxSession); if (!string.IsNullOrEmpty(this.MessageId)) { this.GetELCItemProperties(mailboxSession, this.MessageId); } } } }
// Token: 0x06000916 RID: 2326 RVA: 0x0003D3DC File Offset: 0x0003B5DC protected override void OnPerforming(long cookie) { using (base.Context.CreateReadLock()) { if (base.ShouldContinue(cookie)) { if (NotificationFactories.Instance.IsSummaryEnabled(base.Context.Settings)) { ExDateTime exDateTime = base.ExpectedTime.Date + base.Context.Settings.Text.TextNotification.CalendarNotificationSettings.SummarySettings.NotifyingTimeInDay.TimeOfDay; ExDateTime exDateTime2 = exDateTime + TimeSpan.FromDays(base.Context.Settings.Text.TextNotification.CalendarNotificationSettings.SummarySettings.Duration.Interval); try { using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(ExchangePrincipal.FromLocalServerMailboxGuid(base.Context.Settings.GetADSettings(), base.Context.DatabaseGuid, base.Context.MailboxGuid), CultureInfo.InvariantCulture, "Client=TBA;Action=ReloadReminders")) { if (base.ShouldContinue(cookie)) { IList <CalendarInfo> list = SummaryLoader.Load(base.ExpectedTime, base.Context.Settings.TimeZone.ExTimeZone, mailboxSession, base.Context.DefaultCalendarFolderId, null, exDateTime, exDateTime2); if (0 < list.Count && base.ShouldContinue(cookie)) { new TextNotificationFactory.TextMessagingEmitter(base.Context).Emit(mailboxSession, CalendarNotificationType.Summary, list); } } } } finally { if (base.ShouldContinue(cookie)) { CalendarNotificationInitiator.ScheduleAction(new SummaryGenerating(exDateTime, exDateTime2, base.Context), base.GetType().Name); } } } } } }
internal void SendMdmQuarantineEmail(bool isEnrolled) { using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(this.context.User.ExchangePrincipal, this.context.Request.Culture, "Client=ActiveSync;Action=MDMQuarantineMail")) { this.cultureInfo = mailboxSession.PreferedCulture; MicrosoftExchangeRecipient exchangeRecipient = this.organizationSettings.GetExchangeRecipient(); StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox); using (MessageItem messageItem = MessageItem.CreateAssociated(mailboxSession, defaultFolderId)) { string empty = string.Empty; string empty2 = string.Empty; this.ConstructMDMQuarantineNotificationMail(isEnrolled, out empty, out empty2); messageItem.Subject = empty; using (TextWriter textWriter = messageItem.Body.OpenTextWriter(BodyFormat.TextHtml)) { textWriter.Write(empty2); } messageItem.From = ((exchangeRecipient == null) ? new Participant(mailboxSession.MailboxOwner) : new Participant(exchangeRecipient)); messageItem.Recipients.Add(new Participant(mailboxSession.MailboxOwner), RecipientItemType.To); messageItem[MessageItemSchema.IsDraft] = false; messageItem[MessageItemSchema.IsRead] = false; messageItem.Save(SaveMode.NoConflictResolution); messageItem.Load(); this.context.ProtocolLogger.AppendValue(ProtocolLoggerData.GraphApiCallData, string.Format("qes:{0}", true)); this.globalInfo.ABQMailId = messageItem.Id.ObjectId; this.globalInfo.ABQMailState = ABQMailState.MailPosted; } } }
internal static void ReplaceAttachmentContent(string smtpAddress, string cultureName, string ewsAttachmentID, bool isArchive, Stream source) { ADSessionSettings adsessionSettings; ExchangePrincipal exchangePrincipal = WacUtilities.GetExchangePrincipal(smtpAddress, out adsessionSettings, isArchive); CultureInfo cultureInfo = CultureInfo.GetCultureInfo(cultureName); List <AttachmentId> attachmentIds = new List <AttachmentId>(); IdHeaderInformation idHeaderInformation = ServiceIdConverter.ConvertFromConcatenatedId(ewsAttachmentID, BasicTypes.Attachment, attachmentIds); idHeaderInformation.ToStoreObjectId(); using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(exchangePrincipal, cultureInfo, "Client=OWA;Action=WAC")) { WacUtilities.ProcessAttachment(mailboxSession, ewsAttachmentID, exchangePrincipal, PropertyOpenMode.Modify, delegate(IExchangePrincipal principal, Attachment attachment, Stream stream, bool anyContentProtected) { BinaryReader binaryReader = new BinaryReader(source); stream.Seek(0L, SeekOrigin.Begin); int num = 10000; int num2 = 0; byte[] buffer = new byte[num]; for (;;) { int num3 = binaryReader.Read(buffer, 0, num); num2 += num3; if (num3 == 0) { break; } stream.Write(buffer, 0, num3); } stream.SetLength((long)num2); attachment.Save(); }); } }
public static void UnlockMoveTarget(string serverFQDN, Guid dbGuid, Guid mbxGuid, OrganizationId ordID) { using (ExRpcAdmin exRpcAdmin = ExRpcAdmin.Create("Client=Management", serverFQDN, null, null, null)) { exRpcAdmin.PurgeCachedMailboxObject(mbxGuid); } ExchangePrincipal mailboxOwner = ExchangePrincipal.FromMailboxData(mbxGuid, dbGuid, ordID ?? OrganizationId.ForestWideOrgId, UnlockMoveTargetUtil.EmptyCultures, RemotingOptions.AllowCrossSite); using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(mailboxOwner, CultureInfo.InvariantCulture, "Client=MSExchangeMigration;Action=MailboxRepairRequestUnlockMailbox")) { mailboxSession.Mailbox.SetProperties(new PropertyDefinition[] { MailboxSchema.InTransitStatus }, new object[] { InTransitStatus.SyncDestination }); mailboxSession.Mailbox.Save(); mailboxSession.Mailbox.Load(); mailboxSession.Mailbox.SetProperties(new PropertyDefinition[] { MailboxSchema.InTransitStatus }, new object[] { InTransitStatus.NotInTransit }); mailboxSession.Mailbox.Save(); } }
// Token: 0x06000913 RID: 2323 RVA: 0x0003D118 File Offset: 0x0003B318 protected override void OnPerforming(long cookie) { using (base.Context.CreateReadLock()) { if (!base.ShouldContinue(cookie)) { ExTraceGlobals.AssistantTracer.TraceDebug((long)this.GetHashCode(), "Didn't perform reminder reloading because of cookie"); } else if (!NotificationFactories.Instance.IsReminderEnabled(base.Context.Settings)) { ExTraceGlobals.AssistantTracer.TraceDebug((long)this.GetHashCode(), "Didn't perform reminder reloading because user hasn't enabled reminder"); } else { ExDateTime expectedTime = base.ExpectedTime; ExDateTime exDateTime = expectedTime + TimeSpan.FromDays(1.0); ExDateTime expectedTime2 = exDateTime; string name = base.GetType().Name; try { ExTraceGlobals.AssistantTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Start Reminder Reloading at {0}, {1}", expectedTime.ToShortDateString(), expectedTime.ToLongTimeString()); ExchangePrincipal mailboxOwner = ExchangePrincipal.FromLocalServerMailboxGuid(base.Context.Settings.GetADSettings(), base.Context.DatabaseGuid, base.Context.MailboxGuid); using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(mailboxOwner, CultureInfo.InvariantCulture, "Client=TBA;Action=ReloadReminders")) { if (!base.ShouldContinue(cookie)) { ExTraceGlobals.AssistantTracer.TraceDebug((long)this.GetHashCode(), "Didn't perform reminder reloading because of cookie"); } else { foreach (CalendarInfo calendarInfo in ReminderLoader.Load(base.ExpectedTime, base.Context.Settings.TimeZone.ExTimeZone, mailboxSession, base.Context.DefaultCalendarFolderId, null, expectedTime, exDateTime)) { if (!base.ShouldContinue(cookie)) { ExTraceGlobals.AssistantTracer.TraceDebug((long)this.GetHashCode(), "Didn't perform reminder reloading because of cookie"); break; } expectedTime2 = calendarInfo.ReminderTime + TimeSpan.FromTicks(1L); ReminderEmitting action; if (NotificationFactories.Instance.TryCreateReminderEmitting(calendarInfo, base.Context, out action)) { CalendarNotificationInitiator.ScheduleAction(action, name); } } } } } finally { if (base.ShouldContinue(cookie)) { ExTraceGlobals.AssistantTracer.TraceDebug <string, string>((long)this.GetHashCode(), "The next reminder reloading is scheduled at {0}, {1}", expectedTime2.ToShortDateString(), expectedTime2.ToLongTimeString()); CalendarNotificationInitiator.ScheduleAction(new ReminderReloading(expectedTime2, base.Context), name); } } } } }
internal BaseQueryResult GetDataInternal(FreeBusyQuery freeBusyQuery, EmailAddress emailAddress) { BaseQueryResult result; try { TimeSpan t = this.deadline - DateTime.UtcNow; if (t <= TimeSpan.Zero) { result = this.HandleException(emailAddress, new TimeoutExpiredException("Opening-Mailbox-Session")); } else { using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(freeBusyQuery.ExchangePrincipal, CultureInfo.InvariantCulture, "Client=AS")) { mailboxSession.AccountingObject = this.clientContext.Budget; this.clientContext.CheckOverBudget(); Microsoft.Exchange.Diagnostics.Components.InfoWorker.Availability.ExTraceGlobals.FaultInjectionTracer.TraceTest(2204511549U); t = this.deadline - DateTime.UtcNow; if (t <= TimeSpan.Zero) { result = this.HandleException(emailAddress, new TimeoutExpiredException("Starting-Calendar-Query")); } else { result = this.InternalGetCalendarData(freeBusyQuery, mailboxSession); } } } } catch (MailboxInSiteFailoverException e) { result = this.HandleMailboxFailoverException(emailAddress, e); } catch (MailboxCrossSiteFailoverException e2) { result = this.HandleMailboxFailoverException(emailAddress, e2); } catch (VirusScanInProgressException e3) { LocalizedString message = Strings.descVirusScanInProgress(emailAddress.ToString()); result = this.HandleException(emailAddress, e3, message); } catch (VirusDetectedException e4) { LocalizedString message2 = Strings.descVirusDetected(emailAddress.ToString()); result = this.HandleException(emailAddress, e4, message2); } catch (AuthzException innerException) { result = this.HandleException(emailAddress, new Win32InteropException(innerException)); } catch (LocalizedException e5) { result = this.HandleConnectionException(emailAddress, e5); } return(result); }
// Token: 0x06000662 RID: 1634 RVA: 0x000309BC File Offset: 0x0002EBBC protected override void InvokeInternal() { if (this.IsSystemArbitrationMailbox() && this.IsDumpsterOverQuota()) { this.isOverQuota = true; if (AuditQuotaEnforcer.Tracer.IsTraceEnabled(TraceType.DebugTrace)) { AuditQuotaEnforcer.Tracer.TraceDebug <AuditQuotaEnforcer>((long)this.GetHashCode(), "{0}: The system arbitration mailbox is over dumpster warning quota. Processing the adminaudits folder.", this); } MailboxSession mailboxSession = base.MailboxDataForTags.MailboxSession; MailboxSession mailboxSession2 = null; try { mailboxSession2 = MailboxSession.OpenAsSystemService(mailboxSession.MailboxOwner, CultureInfo.InvariantCulture, mailboxSession.ClientInfoString); } catch (ObjectNotFoundException arg) { if (AuditQuotaEnforcer.Tracer.IsTraceEnabled(TraceType.DebugTrace)) { AuditQuotaEnforcer.Tracer.TraceDebug <IExchangePrincipal, ObjectNotFoundException>((long)mailboxSession.GetHashCode(), "{0}: Failed to reopen the session with SystemService because the mailbox is missing. {1}", mailboxSession.MailboxOwner, arg); } } catch (StorageTransientException arg2) { if (AuditQuotaEnforcer.Tracer.IsTraceEnabled(TraceType.WarningTrace)) { AuditQuotaEnforcer.Tracer.TraceWarning <IExchangePrincipal, MailboxSession, StorageTransientException>((long)mailboxSession.GetHashCode(), "{0}: Failed to reopen the session with SystemService: {1}.\nError:\n{2}", mailboxSession.MailboxOwner, mailboxSession, arg2); } } catch (StoragePermanentException arg3) { if (AuditQuotaEnforcer.Tracer.IsTraceEnabled(TraceType.ErrorTrace)) { AuditQuotaEnforcer.Tracer.TraceError <IExchangePrincipal, MailboxSession, StoragePermanentException>((long)mailboxSession.GetHashCode(), "{0}: Failed to reopen the session with SystemService: {1}.\nError:\n{2}", mailboxSession.MailboxOwner, mailboxSession, arg3); } } if (mailboxSession2 != null) { try { base.MailboxDataForTags.MailboxSession = mailboxSession2; base.InvokeInternal(); } finally { base.MailboxDataForTags.MailboxSession = mailboxSession; mailboxSession2.Dispose(); mailboxSession2 = null; } } if (base.IsEnabled) { this.LogAuditsCleanupEvent(); } } }
private MailboxSession CreateMailboxSession() { ExTraceGlobals.SharingTracer.TraceDebug <SecurityIdentifier>((long)this.GetHashCode(), "Create mailbox session as SystemService for sid {0}.", this.sid); MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(ExchangePrincipal.FromUserSid(this.RecipientSession, this.sid), Thread.CurrentThread.CurrentCulture, "Client=AS;Action=PublishedFolder"); if (this.budget != null) { mailboxSession.AccountingObject = this.budget; } mailboxSession.ExTimeZone = (TimeZoneHelper.GetUserTimeZone(mailboxSession) ?? ExTimeZone.CurrentTimeZone); return(mailboxSession); }
internal void SendABQNotificationMail() { using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(this.context.User.ExchangePrincipal, this.context.Request.Culture, "Client=ActiveSync;Action=ABQMail")) { this.cultureInfo = mailboxSession.PreferedCulture; MicrosoftExchangeRecipient exchangeRecipient = this.organizationSettings.GetExchangeRecipient(); StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox); using (MessageItem messageItem = MessageItem.Create(mailboxSession, defaultFolderId)) { this.ConstructUserNotificationMail(messageItem); messageItem.From = ((exchangeRecipient == null) ? new Participant(mailboxSession.MailboxOwner) : new Participant(exchangeRecipient)); messageItem.Recipients.Add(new Participant(mailboxSession.MailboxOwner), RecipientItemType.To); messageItem[MessageItemSchema.IsDraft] = false; messageItem[MessageItemSchema.IsRead] = false; messageItem.Save(SaveMode.NoConflictResolution); messageItem.Load(new PropertyDefinition[0]); this.globalInfo.ABQMailId = messageItem.Id.ObjectId; this.globalInfo.ABQMailState = ABQMailState.MailPosted; } defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Drafts); if (this.globalInfo.DeviceAccessState == DeviceAccessState.Quarantined) { using (MessageItem messageItem2 = MessageItem.Create(mailboxSession, defaultFolderId)) { foreach (SmtpAddress smtpAddress in this.organizationSettings.AdminMailRecipients) { Participant participant; if (smtpAddress.IsValidAddress && Participant.TryParse(smtpAddress.ToString(), out participant) && participant != null) { messageItem2.Recipients.Add(participant, RecipientItemType.To); } } if (messageItem2.Recipients.Count > 0) { this.ConstructAdminNotificationMail(messageItem2); messageItem2.From = ((exchangeRecipient == null) ? new Participant(mailboxSession.MailboxOwner) : new Participant(exchangeRecipient)); messageItem2.SendWithoutSavingMessage(); } else { AirSyncDiagnostics.TraceError(ExTraceGlobals.RequestsTracer, null, "ABQMail:No valid AdminMailRecipients to send Admin mail to!"); if (VariantConfiguration.InvariantNoFlightingSnapshot.ActiveSync.ActiveSyncDiagnosticsLogABQPeriodicEvent.Enabled) { AirSyncDiagnostics.LogPeriodicEvent(AirSyncEventLogConstants.Tuple_NoAdminMailRecipientsError, "NoAdminMailRecipients", new string[0]); } } } } } }
// Token: 0x06000641 RID: 1601 RVA: 0x0002FDBC File Offset: 0x0002DFBC protected override void InvokeInternal() { if (!base.IsEnabled) { return; } MailboxSession mailboxSession = base.MailboxDataForTags.MailboxSession; MailboxSession mailboxSession2 = null; try { mailboxSession2 = MailboxSession.OpenAsSystemService(mailboxSession.MailboxOwner, CultureInfo.InvariantCulture, mailboxSession.ClientInfoString); } catch (ObjectNotFoundException arg) { if (AuditExpirationEnforcer.Tracer.IsTraceEnabled(TraceType.DebugTrace)) { AuditExpirationEnforcer.Tracer.TraceDebug <IExchangePrincipal, ObjectNotFoundException>((long)mailboxSession.GetHashCode(), "{0}: Failed to reopen the session with SystemService because the mailbox is missing. {1}", mailboxSession.MailboxOwner, arg); } } catch (StorageTransientException arg2) { if (AuditExpirationEnforcer.Tracer.IsTraceEnabled(TraceType.WarningTrace)) { AuditExpirationEnforcer.Tracer.TraceWarning <IExchangePrincipal, MailboxSession, StorageTransientException>((long)mailboxSession.GetHashCode(), "{0}: Failed to reopen the session with SystemService: {1}.\nError:\n{2}", mailboxSession.MailboxOwner, mailboxSession, arg2); } } catch (StoragePermanentException arg3) { if (AuditExpirationEnforcer.Tracer.IsTraceEnabled(TraceType.ErrorTrace)) { AuditExpirationEnforcer.Tracer.TraceError <IExchangePrincipal, MailboxSession, StoragePermanentException>((long)mailboxSession.GetHashCode(), "{0}: Failed to reopen the session with SystemService: {1}.\nError:\n{2}", mailboxSession.MailboxOwner, mailboxSession, arg3); } } if (mailboxSession2 != null) { try { base.MailboxDataForTags.MailboxSession = mailboxSession2; base.InvokeInternal(); } finally { base.MailboxDataForTags.MailboxSession = mailboxSession; mailboxSession2.Dispose(); mailboxSession2 = null; } } }
private MailboxSession OpenSystemMailbox() { MrsTracer.Provider.Function("StorageMailbox.OpenSystemMailbox", new object[0]); base.CheckDisposed(); Server server = LocalServer.GetServer(); ADSystemMailbox adsystemMailbox = MapiUtils.GetADSystemMailbox(base.MdbGuid, null, null); MailboxSession result; using (base.RHTracker.Start()) { ExchangePrincipal mailboxOwner = ExchangePrincipal.FromADSystemMailbox(ADSessionSettings.FromRootOrgScopeSet(), adsystemMailbox, server); result = MailboxSession.OpenAsSystemService(mailboxOwner, CultureInfo.InvariantCulture, "Client=MSExchangeMigration"); } return(result); }
// Token: 0x06000BF5 RID: 3061 RVA: 0x00031C20 File Offset: 0x0002FE20 internal void InstallExtensionUpdates(List <ExtensionData> updates, UpdateQueryContext queryContext) { GetUpdates.Tracer.TraceDebug <int>(0L, "GetUpdates.InstallExtensionUpdates: Installing {0} extensions.", updates.Count); ExtensionData currentExtensionData = null; Exception ex = InstalledExtensionTable.RunClientExtensionAction(delegate { using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(queryContext.ExchangePrincipal, queryContext.CultureInfo, queryContext.ClientInfoString)) { using (InstalledExtensionTable installedExtensionTable = InstalledExtensionTable.CreateInstalledExtensionTable(queryContext.Domain, queryContext.IsUserScope, queryContext.OrgEmptyMasterTableCache, mailboxSession)) { foreach (ExtensionData currentExtensionData in updates) { currentExtensionData = currentExtensionData; GetUpdates.Tracer.TraceDebug <string>(0L, "GetUpdates.InstallExtensionUpdates: Installing asset {0}", currentExtensionData.MarketplaceAssetID); installedExtensionTable.AddExtension(currentExtensionData, true); currentExtensionData = null; } installedExtensionTable.SaveXML(); } } }); string text = (currentExtensionData == null) ? string.Empty : currentExtensionData.MarketplaceAssetID; if (ex != null) { GetUpdates.Tracer.TraceError <string, Exception>(0L, "GetUpdates.InstallExtensionUpdates: Installation failed for extension {0}. Exception: {1}", text, ex); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_ExtensionUpdateFailed, null, new object[] { "UpdateExtension", ExtensionDiagnostics.GetLoggedMailboxIdentifier(queryContext.ExchangePrincipal), text, ExtensionDiagnostics.GetLoggedExceptionString(ex) }); } else { ExtensionDiagnostics.LogToDatacenterOnly(ApplicationLogicEventLogConstants.Tuple_ExtensionUpdateSuccess, null, new object[] { "UpdateExtension", ExtensionDiagnostics.GetLoggedMailboxIdentifier(queryContext.ExchangePrincipal), text }); } this.ExecuteNextUpdateQuery(); }
internal void SendAutoBlockNotificationMail(TimeSpan blockTime, string adminEmailInsert) { using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(this.context.User.ExchangePrincipal, this.context.Request.Culture, "Client=ActiveSync;Action=AutoBlockMail")) { this.cultureInfo = mailboxSession.PreferedCulture; MicrosoftExchangeRecipient exchangeRecipient = this.organizationSettings.GetExchangeRecipient(); StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Inbox); using (MessageItem messageItem = MessageItem.Create(mailboxSession, defaultFolderId)) { this.ConstructAutoBlockNotificationMail(messageItem, blockTime, adminEmailInsert); messageItem.From = ((exchangeRecipient == null) ? new Participant(mailboxSession.MailboxOwner) : new Participant(exchangeRecipient)); messageItem.Recipients.Add(new Participant(mailboxSession.MailboxOwner), RecipientItemType.To); messageItem[MessageItemSchema.IsDraft] = false; messageItem[MessageItemSchema.IsRead] = false; messageItem.Save(SaveMode.NoConflictResolution); } } }
// Token: 0x0600074A RID: 1866 RVA: 0x0001C7C0 File Offset: 0x0001A9C0 private MailboxSession GetMailboxSession(string organizationIdEncoded, Guid mailboxGuid) { CacheEntry <MailboxSession> cacheEntry; MailboxSession result; if (this.sessions.TryGetValue(mailboxGuid, DateTime.UtcNow, out cacheEntry)) { result = cacheEntry.Value; } else { OrganizationId organizationId = AuditRecordDatabaseWriterVisitor.GetOrganizationId(organizationIdEncoded); ADSessionSettings adSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest(), organizationId, null, false); ExchangePrincipal mailboxOwner = ExchangePrincipal.FromMailboxGuid(adSettings, mailboxGuid, RemotingOptions.AllowCrossSite, null); result = MailboxSession.OpenAsSystemService(mailboxOwner, CultureInfo.InvariantCulture, "Client=Management;Action=AuditLog"); } return(result); }
private void WriteTokensToMailbox() { if (this.downloadedTokens.Count == 0 && this.appStatuses.Count == 0) { return; } GetTokens.Tracer.TraceDebug <int, int>(0L, "GetTokens.WriteTokensToMailbox: Writing renewed tokens for {0} apps, failure error codes for {0} apps.", this.downloadedTokens.Count, this.appStatuses.Count); Exception ex = InstalledExtensionTable.RunClientExtensionAction(delegate { using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(this.queryContext.ExchangePrincipal, this.queryContext.CultureInfo, this.queryContext.ClientInfoString)) { using (InstalledExtensionTable installedExtensionTable = InstalledExtensionTable.CreateInstalledExtensionTable(this.queryContext.Domain, this.queryContext.IsUserScope, this.queryContext.OrgEmptyMasterTableCache, mailboxSession)) { foreach (KeyValuePair <string, string> keyValuePair in this.downloadedTokens) { installedExtensionTable.ConfigureEtoken(keyValuePair.Key, keyValuePair.Value, true); } foreach (KeyValuePair <string, string> keyValuePair2 in this.appStatuses) { installedExtensionTable.ConfigureAppStatus(keyValuePair2.Key, keyValuePair2.Value); } installedExtensionTable.SaveXML(); } } }); if (ex != null) { GetTokens.Tracer.TraceError <Exception>(0L, "GetTokens.WriteTokensToMailbox: Writing renewed tokens failed. Exception: {0}", ex); ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_FailedToWritebackRenewedTokens, null, new object[] { "ProcessTokenRenew", ExtensionDiagnostics.GetLoggedMailboxIdentifier(this.queryContext.ExchangePrincipal), ExtensionDiagnostics.GetLoggedExceptionString(ex) }); return; } ExtensionDiagnostics.LogToDatacenterOnly(ApplicationLogicEventLogConstants.Tuple_ProcessTokenRenewCompleted, null, new object[] { "ProcessTokenRenew", ExtensionDiagnostics.GetLoggedMailboxIdentifier(this.queryContext.ExchangePrincipal) }); }
private StoreSession OpenMailboxSession(Guid mdbGuid, Guid mailboxGuid) { if (mailboxGuid == Guid.Empty) { return(null); } try { ExchangePrincipal mailboxOwner = ExchangePrincipal.FromMailboxData(mailboxGuid, mdbGuid, GetFailedDocuments.EmptyCultureInfoCollection, RemotingOptions.AllowCrossSite); return(MailboxSession.OpenAsSystemService(mailboxOwner, CultureInfo.InvariantCulture, "Client=Management;Action=GetFailedDocuments")); } catch (StoragePermanentException exception) { base.WriteError(exception, ErrorCategory.ReadError, null); } catch (StorageTransientException exception2) { base.WriteError(exception2, ErrorCategory.ReadError, null); } return(null); }
// Token: 0x060009A4 RID: 2468 RVA: 0x00040A08 File Offset: 0x0003EC08 public static MailboxData CreateFromUserSettings(UserSettings settings) { MailboxData result; try { MailboxData mailboxData = null; ExchangePrincipal mailboxOwner = ExchangePrincipal.FromLegacyDN(settings.GetADSettings(), settings.LegacyDN); using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(mailboxOwner, CultureInfo.InvariantCulture, "Client=TBA;Action=GetInitialState")) { mailboxData = new MailboxData(mailboxSession); } mailboxData.Settings = settings; result = mailboxData; } catch (AdUserNotFoundException arg) { ExTraceGlobals.AssistantTracer.TraceDebug <string, AdUserNotFoundException>((long)typeof(MailboxData).GetHashCode(), "cannot find AD user: {0}", settings.LegacyDN, arg); result = null; } return(result); }
private bool LogonArchive(ExchangePrincipal mailboxEP) { bool result; using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(mailboxEP, CultureInfo.InvariantCulture, "Client=Monitoring;Action=Test-ArchiveConnectivity")) { if (mailboxSession != null) { if (this.IncludeArchiveMRMConfiguration || !string.IsNullOrEmpty(this.MessageId)) { UserConfiguration userConfiguration = ElcMailboxHelper.OpenFaiMessage(mailboxSession, "MRM", false); if (userConfiguration != null) { using (Stream xmlStream = userConfiguration.GetXmlStream()) { using (StreamReader streamReader = new StreamReader(xmlStream)) { this.archiveFAI = streamReader.ReadToEnd(); } goto IL_80; } } this.archiveFAI = "No FAI found in Archive Mailbox."; IL_80: this.archiveLastProcessedTime = this.ReadMailboxTableProperties(mailboxSession); if (!string.IsNullOrEmpty(this.MessageId)) { this.GetELCItemProperties(mailboxSession, this.MessageId); } } result = true; } else { result = false; } } return(result); }
// Token: 0x06000D93 RID: 3475 RVA: 0x0004AF14 File Offset: 0x00049114 internal static void SendBootstrapMailForWM61(IAirSyncUser user) { if (user == null) { throw new ArgumentNullException("user"); } if (user.ExchangePrincipal == null) { throw new ArgumentNullException("user.ExchangePrincipal"); } using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(user.ExchangePrincipal, CultureInfo.InvariantCulture, "Client=ActiveSync")) { CultureInfo preferedCulture = mailboxSession.PreferedCulture; string subject = Strings.BootstrapMailForWM61Subject.ToString(preferedCulture); string text = string.Format("<a href=\"{0}\">{1}</a>", GlobalSettings.MobileUpdateInformationURL, AirSyncUtility.HtmlEncode(Strings.BootstrapMailForWM61Body7.ToString(preferedCulture), false)); string text2 = string.Format("<a href=\"{0}\">{1}</a>", GlobalSettings.BootstrapCABForWM61HostingURL, AirSyncUtility.HtmlEncode(Strings.BootstrapMailForWM61Body8.ToString(preferedCulture), false)); string text3 = string.Empty; IOrganizationSettingsData organizationSettingsData = ADNotificationManager.GetOrganizationSettingsData(user); if (organizationSettingsData != null && !string.IsNullOrEmpty(organizationSettingsData.OtaNotificationMailInsert)) { text3 = string.Format("<p>{0}</p><hr>", organizationSettingsData.OtaNotificationMailInsert); } string body = string.Format("<html><head><style>p, li {{font-size:10pt; font-family:Tahoma;}}</style></head><body><p style=\"font-size:12pt; color:darkblue;\"><b>{0}</b></p><p>{1}</p><ul><li>{2}</li><li>{3}</li><li>{4}</li><li>{5}</li><li>{6}</li></ul><p><span style=\"font-size:12pt;\"><b>{7}</b></span><br>{8}</p><hr>{9}<p style=\"font-size:8pt; color:gray;\">{10}</p></body></html>", new object[] { AirSyncUtility.HtmlEncode(Strings.BootstrapMailForWM61Body1.ToString(preferedCulture), false), AirSyncUtility.HtmlEncode(Strings.BootstrapMailForWM61Body2.ToString(preferedCulture), false), AirSyncUtility.HtmlEncode(Strings.BootstrapMailForWM61Body3.ToString(preferedCulture), false), AirSyncUtility.HtmlEncode(Strings.BootstrapMailForWM61Body4.ToString(preferedCulture), false), AirSyncUtility.HtmlEncode(Strings.BootstrapMailForWM61Body5.ToString(preferedCulture), false), AirSyncUtility.HtmlEncode(Strings.BootstrapMailForWM61Body6.ToString(preferedCulture), false), text, text2, AirSyncUtility.HtmlEncode(Strings.BootstrapMailForWM61Body9.ToString(preferedCulture), false), text3, AirSyncUtility.HtmlEncode(Strings.BootstrapMailForWM61Body10.ToString(preferedCulture), false) }); SystemMessageHelper.PostMessage(mailboxSession, subject, body, "IPM.Note", Importance.High); } }
private static void ProcessAttachment(WacRequest wacRequest, PropertyOpenMode openMode, WacUtilities.AttachmentProcessor attachmentProcessor) { ADSessionSettings adSessionSettings; ExchangePrincipal exchangePrincipal = WacUtilities.GetExchangePrincipal(wacRequest, out adSessionSettings, wacRequest.WacFileRep.IsArchive); WacRequestHandler.ProcessUsingBudget(wacRequest.WacFileRep.LogonSid, delegate { string ewsAttachmentId = wacRequest.EwsAttachmentId; CultureInfo cultureInfo = CultureInfo.GetCultureInfo(wacRequest.CultureName); string clientInfoString = "Client=OWA;Action=WAC"; if (exchangePrincipal.RecipientTypeDetails.HasFlag(RecipientTypeDetails.PublicFolder) || exchangePrincipal.RecipientTypeDetails.HasFlag(RecipientTypeDetails.PublicFolderMailbox)) { using (PublicFolderSession publicFolderSession = PublicFolderSession.OpenAsAdmin(null, exchangePrincipal, null, cultureInfo, clientInfoString, null)) { WacUtilities.ProcessAttachment(publicFolderSession, ewsAttachmentId, exchangePrincipal, openMode, attachmentProcessor); return; } } using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(exchangePrincipal, cultureInfo, clientInfoString)) { WacUtilities.ProcessAttachment(mailboxSession, ewsAttachmentId, exchangePrincipal, openMode, attachmentProcessor); } }, adSessionSettings); }
private SharingSubscriptionData[] LoadAllSubscriptions() { try { if (this.requesterBudget != null) { this.requesterBudget.CheckOverBudget(); } ExchangePrincipal mailboxOwner = ExchangePrincipal.FromADUser(this.adUser, null); using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(mailboxOwner, CultureInfo.InvariantCulture, "Client=AS")) { if (this.requesterBudget != null) { mailboxSession.AccountingObject = this.requesterBudget; } try { using (SharingSubscriptionManager sharingSubscriptionManager = new SharingSubscriptionManager(mailboxSession)) { return(sharingSubscriptionManager.GetAll()); } } catch (ObjectNotFoundException) { } } } catch (OverBudgetException handledException) { this.HandledException = handledException; } catch (ConnectionFailedPermanentException handledException2) { this.HandledException = handledException2; } catch (ObjectNotFoundException handledException3) { this.HandledException = handledException3; } catch (ConnectionFailedTransientException handledException4) { this.HandledException = handledException4; } catch (AccountDisabledException handledException5) { this.HandledException = handledException5; } catch (VirusScanInProgressException innerException) { LocalizedString localizedString = Strings.descVirusScanInProgress(this.adUser.PrimarySmtpAddress.ToString()); this.HandledException = new LocalizedException(localizedString, innerException); } catch (VirusDetectedException innerException2) { LocalizedString localizedString2 = Strings.descVirusDetected(this.adUser.PrimarySmtpAddress.ToString()); this.HandledException = new LocalizedException(localizedString2, innerException2); } catch (StoragePermanentException handledException6) { this.HandledException = handledException6; } catch (StorageTransientException handledException7) { this.HandledException = handledException7; } return(new SharingSubscriptionData[0]); }
private MailboxSession OpenMailboxSession() { IEnumerable <ADRecipient> objects = this.Identity.GetObjects <ADRecipient>(null, base.DataSession); MailboxSession result; using (IEnumerator <ADRecipient> enumerator = objects.GetEnumerator()) { if (!enumerator.MoveNext()) { base.WriteError(new MailboxFolderStatisticsException(this.Identity.ToString(), Strings.RecipientNotFoundException(this.Identity.ToString())), ErrorCategory.ReadError, null); } ADRecipient adrecipient = enumerator.Current; if (enumerator.MoveNext()) { base.WriteError(new MailboxFolderStatisticsException(this.Identity.ToString(), Strings.RecipientNotUniqueException(this.Identity.ToString())), ErrorCategory.ReadError, null); } if (adrecipient.RecipientType == RecipientType.MailUser && !this.Archive.IsPresent) { base.WriteError(new MailboxFolderStatisticsException(this.Identity.ToString(), Strings.RecipientTypeNotValid(this.Identity.ToString())), ErrorCategory.InvalidArgument, null); } if (adrecipient.RecipientTypeDetails == RecipientTypeDetails.AuditLogMailbox && !this.AuditLog) { base.WriteError(new MailboxFolderStatisticsException(this.Identity.ToString(), Strings.RecipientNotFoundException(this.Identity.ToString())), ErrorCategory.ReadError, null); } ExchangePrincipal exchangePrincipal = null; if (this.Identity.RawMailboxGuidInvolvedInSearch != Guid.Empty) { ADUser aduser = adrecipient as ADUser; if (aduser != null && aduser.MailboxLocations != null) { IMailboxLocationInfo mailboxLocation = aduser.MailboxLocations.GetMailboxLocation(this.Identity.RawMailboxGuidInvolvedInSearch); if (mailboxLocation != null) { try { exchangePrincipal = ExchangePrincipal.FromMailboxGuid(adrecipient.Session.SessionSettings, mailboxLocation.MailboxGuid, null); } catch (ObjectNotFoundException) { base.WriteError(new MailboxFolderStatisticsException(this.Identity.ToString(), Strings.RecipientNotFoundException(this.Identity.ToString())), ErrorCategory.ReadError, null); } } } } if (exchangePrincipal == null) { ExchangePrincipal exchangePrincipal2 = null; try { exchangePrincipal2 = ExchangePrincipal.FromLegacyDN(adrecipient.OrganizationId.ToADSessionSettings(), adrecipient.LegacyExchangeDN, RemotingOptions.AllowCrossSite | RemotingOptions.AllowCrossPremise); } catch (ObjectNotFoundException) { base.WriteError(new MailboxFolderStatisticsException(this.Identity.ToString(), Strings.RecipientNotFoundException(this.Identity.ToString())), ErrorCategory.ReadError, null); return(null); } exchangePrincipal = exchangePrincipal2; if (this.Archive && adrecipient.RecipientType != RecipientType.MailUser) { if (exchangePrincipal2.GetArchiveMailbox() != null) { exchangePrincipal = exchangePrincipal2.GetArchiveExchangePrincipal(); } else { base.WriteError(new MailboxFolderStatisticsException(this.Identity.ToString(), Strings.ErrorArchiveNotEnabled(this.Identity.ToString())), ErrorCategory.InvalidArgument, this.Identity); } } } try { result = MailboxSession.OpenAsSystemService(exchangePrincipal, CultureInfo.InvariantCulture, "Client=Management;Action=Get-MailboxFolderStatistics"); } catch (StorageTransientException ex) { base.WriteError(new MailboxFolderStatisticsException(this.Identity.ToString(), Strings.ExceptionStorageOther(ex.ErrorCode, ex.Message)), ErrorCategory.ReadError, null); result = null; } catch (StoragePermanentException ex2) { string failure; if (ex2 is AccessDeniedException) { failure = Strings.ExceptionStorageAccessDenied(ex2.ErrorCode, ex2.Message); } else { failure = Strings.ExceptionStorageOther(ex2.ErrorCode, ex2.Message); } base.WriteError(new MailboxFolderStatisticsException(this.Identity.ToString(), failure), ErrorCategory.ReadError, null); result = null; } } return(result); }
internal static MailboxSession OpenMailboxSessionAsSystemService(IExchangePrincipal principal, string clientString) { return(MailboxSession.OpenAsSystemService(principal, CultureInfo.InvariantCulture, clientString)); }
// Token: 0x06000A2B RID: 2603 RVA: 0x00042F58 File Offset: 0x00041158 public void Emit(MailboxSession session, CalendarNotificationType type, IList <CalendarInfo> events) { ExTraceGlobals.AssistantTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Text Emitter is invoked, subject: {0} for user {1}", events[0].NormalizedSubject, this.MailboxData.Settings.LegacyDN); if (type == CalendarNotificationType.Uninteresting) { return; } Emitter emitter = null; foreach (Emitter emitter2 in this.MailboxData.Settings.Text.TextNotification.CalendarNotificationSettings.Emitters) { if (EmitterType.TextMessaging == emitter2.Type) { emitter = emitter2; break; } } if (emitter == null || emitter.PhoneNumbers.Count == 0) { return; } MailboxRegionalConfiguration regionalConfiguration = this.MailboxData.Settings.Text.RegionalConfiguration; CultureInfo cultureInfo = regionalConfiguration.Language ?? CultureInfo.InvariantCulture; string text = regionalConfiguration.TimeFormat; if (string.IsNullOrEmpty(text)) { text = cultureInfo.DateTimeFormat.ShortTimePattern; } string text2 = regionalConfiguration.DateFormat; if (string.IsNullOrEmpty(text2)) { text2 = cultureInfo.DateTimeFormat.ShortDatePattern; } bool flag = false; try { if (session == null) { ExchangePrincipal mailboxOwner = ExchangePrincipal.FromLocalServerMailboxGuid(this.MailboxData.Settings.GetADSettings(), this.MailboxData.DatabaseGuid, this.MailboxData.MailboxGuid); session = MailboxSession.OpenAsSystemService(mailboxOwner, CultureInfo.InvariantCulture, "Client=TBA;Action=Emit"); flag = true; } ExTraceGlobals.AssistantTracer.TraceDebug <string>((long)this.GetHashCode(), "Text Emitter is emitting for user {0}", this.MailboxData.Settings.LegacyDN); if (CalendarNotificationType.Summary == type) { CalendarNotificationContentVersion1Point0 calendarNotificationContentVersion1Point = new CalendarNotificationContentVersion1Point0(); calendarNotificationContentVersion1Point.CalNotifType = type; calendarNotificationContentVersion1Point.CalNotifTypeDesc = Strings.notifTypeSummary.ToString(cultureInfo); string agendaDateFormat = TextNotificationFactory.TextMessagingEmitter.GetAgendaDateFormat(text2); string timeOfStartTime = string.Empty; foreach (CalendarInfo calendarInfo in events) { timeOfStartTime = calendarInfo.StartTime.ToString("H:mm", cultureInfo); if (calendarInfo.EndTime.Subtract(calendarInfo.StartTime).Equals(TimeSpan.FromDays(1.0)) && calendarInfo.StartTime.Hour == 0 && calendarInfo.StartTime.Minute == 0) { timeOfStartTime = string.Empty; } calendarNotificationContentVersion1Point.CalEvents.Add(new CalendarEvent(cultureInfo.DateTimeFormat.GetDayName(calendarInfo.StartTime.DayOfWeek), calendarInfo.StartTime.ToString(agendaDateFormat, cultureInfo), timeOfStartTime, cultureInfo.DateTimeFormat.GetDayName(calendarInfo.EndTime.DayOfWeek), calendarInfo.EndTime.ToString(agendaDateFormat, cultureInfo), calendarInfo.EndTime.ToString("H:mm", cultureInfo), calendarInfo.NormalizedSubject ?? string.Empty, calendarInfo.Location ?? string.Empty)); } TextNotificationFactory.TextMessagingEmitter.SendTextMessage(session, emitter.PhoneNumbers, calendarNotificationContentVersion1Point.ToString(), CalNotifsCounters.NumberOfAgendasSent); } else { foreach (CalendarInfo calendarInfo2 in events) { CalendarNotificationContentVersion1Point0 calendarNotificationContentVersion1Point2 = new CalendarNotificationContentVersion1Point0(); calendarNotificationContentVersion1Point2.CalNotifType = type; bool flag2 = false; ExPerformanceCounter perfcounter; switch (type) { case CalendarNotificationType.Reminder: calendarNotificationContentVersion1Point2.CalNotifTypeDesc = Strings.notifTypeReminder.ToString(cultureInfo); perfcounter = CalNotifsCounters.NumberOfTextRemindersSent; break; case CalendarNotificationType.NewUpdate: calendarNotificationContentVersion1Point2.CalNotifTypeDesc = Strings.notifTypeNewUpdate.ToString(cultureInfo); perfcounter = CalNotifsCounters.NumberOfUpdatesSent; flag2 = true; break; case CalendarNotificationType.ChangedUpdate: calendarNotificationContentVersion1Point2.CalNotifTypeDesc = Strings.notifTypeChangedUpdate.ToString(cultureInfo); perfcounter = CalNotifsCounters.NumberOfUpdatesSent; flag2 = true; break; case CalendarNotificationType.DeletedUpdate: calendarNotificationContentVersion1Point2.CalNotifTypeDesc = Strings.notifTypeDeletedUpdate.ToString(cultureInfo); perfcounter = CalNotifsCounters.NumberOfUpdatesSent; flag2 = true; break; default: throw new InvalidOperationException("unsupported CalendarNotificationType"); } if (flag2) { CalendarChangeProcessor.UpdateAverageProcessingLatency(calendarInfo2.CreationRequestTime); } calendarNotificationContentVersion1Point2.CalEvents.Add(new CalendarEvent(cultureInfo.DateTimeFormat.GetDayName(calendarInfo2.StartTime.DayOfWeek), calendarInfo2.StartTime.ToString(text2, cultureInfo), calendarInfo2.StartTime.ToString(text, cultureInfo), cultureInfo.DateTimeFormat.GetDayName(calendarInfo2.EndTime.DayOfWeek), calendarInfo2.EndTime.ToString(text2, cultureInfo), calendarInfo2.EndTime.ToString(text, cultureInfo), calendarInfo2.NormalizedSubject ?? string.Empty, calendarInfo2.Location ?? string.Empty)); TextNotificationFactory.TextMessagingEmitter.SendTextMessage(session, emitter.PhoneNumbers, calendarNotificationContentVersion1Point2.ToString(), perfcounter); } } ExTraceGlobals.AssistantTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Text Emitter is emitted, subject: {0}, user: {1}", events[0].NormalizedSubject, this.MailboxData.Settings.LegacyDN); } finally { if (flag) { session.Dispose(); session = null; } } }
public static MailboxSession GetMailboxSession(ExchangePrincipal exchangePrincipal, string clientInfo) { return(AdminAuditLogHelper.RetryOnStorageTransientException <MailboxSession>(() => MailboxSession.OpenAsSystemService(exchangePrincipal, CultureInfo.InvariantCulture, clientInfo))); }
// 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); }
// Token: 0x060001EC RID: 492 RVA: 0x0000753E File Offset: 0x0000573E private static MailboxSession OpenMailboxSession(ExchangePrincipal mailboxOwner) { return(MailboxSession.OpenAsSystemService(mailboxOwner, CultureInfo.InvariantCulture, "Client=AnchorService;Privilege:OpenAsSystemService")); }