// Token: 0x06000B7A RID: 2938 RVA: 0x0004A418 File Offset: 0x00048618 private static bool InternalCheckForAutomaticBooking(bool isEventForConfigObject, MailboxSession itemStore, CachedState cachedState) { cachedState.LockForRead(); CalendarConfiguration calendarConfiguration; try { calendarConfiguration = (cachedState.State[0] as CalendarConfiguration); if (calendarConfiguration == null || isEventForConfigObject) { LockCookie lockCookie = cachedState.UpgradeToWriterLock(); try { using (CalendarConfigurationDataProvider calendarConfigurationDataProvider = new CalendarConfigurationDataProvider(itemStore)) { calendarConfiguration = (CalendarConfiguration)calendarConfigurationDataProvider.Read <CalendarConfiguration>(null); if (calendarConfiguration == null) { Globals.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_CorruptCalendarConfiguration, null, new object[] { itemStore.MailboxOwner.LegacyDn }); calendarConfigurationDataProvider.Delete(new CalendarConfiguration()); calendarConfiguration = new CalendarConfiguration(); } } if (calendarConfiguration.AutomateProcessing == CalendarProcessingFlags.AutoAccept) { calendarConfiguration.AddNewRequestsTentatively = true; } cachedState.State[0] = calendarConfiguration; ResourceCheck.Tracer.TraceDebug((long)itemStore.GetHashCode(), "{0}: The calendar settings object was new or has been changed - (re)reading contents.", new object[] { TraceContext.Get() }); } catch (ObjectNotFoundException innerException) { ResourceCheck.Tracer.TraceError((long)itemStore.GetHashCode(), "{0}: The calendar configuration was deleted while we were looking at it. Back off and retry.", new object[] { TraceContext.Get() }); throw new TransientMailboxException(innerException); } finally { cachedState.DowngradeFromWriterLock(ref lockCookie); } } } finally { cachedState.ReleaseReaderLock(); } ResourceCheck.Tracer.TraceDebug <object, CalendarProcessingFlags>((long)itemStore.GetHashCode(), "{0}: MailboxType {1}", TraceContext.Get(), calendarConfiguration.AutomateProcessing); ResourceCheck.TracerPfd.TracePfd <int, object, CalendarProcessingFlags>((long)itemStore.GetHashCode(), "PFD IWR {0} {1}: ResourceMailbox: {2}", 19223, TraceContext.Get(), calendarConfiguration.AutomateProcessing); return(calendarConfiguration.AutomateProcessing == CalendarProcessingFlags.AutoAccept); }
internal bool CommitChanges(MailboxSession mailboxSession) { if (mailboxSession == null) { throw new ArgumentNullException("mailboxSession"); } try { using (CalendarConfigurationDataProvider calendarConfigurationDataProvider = new CalendarConfigurationDataProvider(mailboxSession)) { CalendarConfiguration calendarConfiguration = (CalendarConfiguration)calendarConfigurationDataProvider.Read <CalendarConfiguration>(null); if (calendarConfiguration == null) { string message = string.Format("Unable to load Calendar configuration object for mailbox {0}", mailboxSession.MailboxOwner.LegacyDn); ExTraceGlobals.CalendarCallTracer.TraceDebug(0L, message); calendarConfigurationDataProvider.Delete(new CalendarConfiguration()); calendarConfiguration = (CalendarConfiguration)calendarConfigurationDataProvider.Read <CalendarConfiguration>(null); if (calendarConfiguration == null) { message = string.Format("Unable to re-create Calendar configuration object for mailbox {0}", mailboxSession.MailboxOwner.LegacyDn); ExTraceGlobals.CalendarCallTracer.TraceDebug(0L, message); return(false); } } calendarConfiguration.AddNewRequestsTentatively = this.addNewRequestsTentatively; calendarConfiguration.RemoveOldMeetingMessages = this.removeOldMeetingMessages; calendarConfiguration.RemoveForwardedMeetingNotifications = this.removeForwardedMeetingNotifications; calendarConfiguration.DefaultReminderTime = this.defaultReminderTime; calendarConfiguration.ProcessExternalMeetingMessages = this.processExternalMeetingMessages; calendarConfigurationDataProvider.Save(calendarConfiguration); } } catch (ObjectExistedException ex) { string message2 = string.Format("Unable to load Calendar configuration object for mailbox. Exception {0}", ex.Message); ExTraceGlobals.CalendarCallTracer.TraceDebug(0L, message2); return(false); } catch (StoragePermanentException ex2) { string message3 = string.Format("Unable to load Calendar configuration object for mailbox. Exception {0}", ex2.Message); ExTraceGlobals.CalendarCallTracer.TraceDebug(0L, message3); return(false); } catch (StorageTransientException ex3) { string message4 = string.Format("Unable to load Calendar configuration object for mailbox. Exception {0}", ex3.Message); ExTraceGlobals.CalendarCallTracer.TraceDebug(0L, message4); return(false); } return(true); }
internal override CalendarProcessingFlags?GetCalendarConfig() { CalendarConfiguration calendarConfiguration = null; using (CalendarConfigurationDataProvider calendarConfigurationDataProvider = new CalendarConfigurationDataProvider(this.session)) { calendarConfiguration = (CalendarConfiguration)calendarConfigurationDataProvider.Read <CalendarConfiguration>(null); } if (calendarConfiguration == null) { Globals.ConsistencyChecksTracer.TraceWarning(0L, "Could not load the attendee's calendar configuration data. Skipping mailbox."); return(null); } return(new CalendarProcessingFlags?(calendarConfiguration.AutomateProcessing)); }
private static CalendarSettings.LoadResult LoadFromMailbox(MailboxSession mailboxSession, bool canActAsOwner, out CalendarSettings calendarSettings) { if (!canActAsOwner) { calendarSettings = null; return(CalendarSettings.LoadResult.AccessDenied); } CalendarConfiguration calendarConfiguration; try { using (CalendarConfigurationDataProvider calendarConfigurationDataProvider = new CalendarConfigurationDataProvider(mailboxSession)) { calendarConfiguration = (CalendarConfiguration)calendarConfigurationDataProvider.Read <CalendarConfiguration>(null); } if (calendarConfiguration == null) { string message = string.Format("Unable to load Calendar configuration object for mailbox {0}", mailboxSession.MailboxOwner.LegacyDn); ExTraceGlobals.CalendarCallTracer.TraceDebug(0L, message); calendarSettings = null; return(CalendarSettings.LoadResult.Corrupt); } } catch (StoragePermanentException ex) { string message2 = string.Format("Unable to load Calendar configuration object for mailbox. Exception {0}", ex.Message); ExTraceGlobals.CalendarCallTracer.TraceDebug(0L, message2); calendarSettings = null; return(CalendarSettings.LoadResult.Missing); } catch (StorageTransientException ex2) { string message3 = string.Format("Unable to load Calendar configuration object for mailbox. Exception {0}", ex2.Message); ExTraceGlobals.CalendarCallTracer.TraceDebug(0L, message3); calendarSettings = null; return(CalendarSettings.LoadResult.Missing); } calendarSettings = new CalendarSettings(CalendarSettings.ValidateReminderInterval(calendarConfiguration.DefaultReminderTime), calendarConfiguration.AddNewRequestsTentatively, calendarConfiguration.ProcessExternalMeetingMessages, calendarConfiguration.RemoveOldMeetingMessages, calendarConfiguration.RemoveForwardedMeetingNotifications); return(CalendarSettings.LoadResult.Success); }
private void ConfigureCalendar() { MailboxCalendarConfiguration mailboxCalendarConfiguration = new MailboxCalendarConfiguration { Principal = this.MailboxPrincipal, RemindersEnabled = false, ReminderSoundEnabled = false }; mailboxCalendarConfiguration.Save(this.mailboxStoreTypeProvider); this.TraceDebug("Save settings to disable calendar reminder", new object[0]); using (CalendarConfigurationDataProvider calendarConfigurationDataProvider = new CalendarConfigurationDataProvider(this.mailboxSession)) { CalendarConfiguration instance = new CalendarConfiguration { MailboxOwnerId = this.group.Id, RemoveForwardedMeetingNotifications = true, RemoveOldMeetingMessages = true }; calendarConfigurationDataProvider.Save(instance); this.TraceDebug("Save settings to disable calendar forward notification.", new object[0]); } }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(new object[] { this.DataObject }); bool flag = false; if (false == this.Force && this.Arbitration) { TIdentity identity = this.Identity; if (!base.ShouldContinue(Strings.SetArbitrationMailboxConfirmationMessage(identity.ToString()))) { TaskLogger.LogExit(); return; } } if (false == this.Force && this.originalForwardingAddress == null && this.DataObject.ForwardingAddress != null && this.DataObject.ForwardingSmtpAddress != null) { LocalizedString message = (this.originalForwardingSmtpAddress != null) ? Strings.SetMailboxForwardingAddressConfirmationMessage : Strings.SetBothForwardingAddressConfirmationMessage; if (!base.ShouldContinue(message)) { TaskLogger.LogExit(); return; } } if (this.DataObject.IsModified(MailboxSchema.ForwardingSmtpAddress) && this.DataObject.ForwardingSmtpAddress != null && this.DataObject.ForwardingAddress != null && !base.Fields.IsModified(MailboxSchema.ForwardingAddress)) { this.WriteWarning(Strings.ContactAdminForForwardingWarning); } if (false == this.Force && this.DataObject.IsModified(ADRecipientSchema.AuditLogAgeLimit)) { EnhancedTimeSpan t; if (this.DataObject.MailboxAuditLogAgeLimit == EnhancedTimeSpan.Zero) { TIdentity identity2 = this.Identity; if (!base.ShouldContinue(Strings.ConfirmationMessageSetMailboxAuditLogAgeLimitZero(identity2.ToString()))) { TaskLogger.LogExit(); return; } } else if (this.DataObject.TryGetOriginalValue<EnhancedTimeSpan>(ADRecipientSchema.AuditLogAgeLimit, out t)) { EnhancedTimeSpan mailboxAuditLogAgeLimit = this.DataObject.MailboxAuditLogAgeLimit; if (t > mailboxAuditLogAgeLimit) { TIdentity identity3 = this.Identity; if (!base.ShouldContinue(Strings.ConfirmationMessageSetMailboxAuditLogAgeLimitSmaller(identity3.ToString(), mailboxAuditLogAgeLimit.ToString()))) { TaskLogger.LogExit(); return; } } } } bool flag2 = false; bool flag3 = false; MapiMessageStoreSession mapiMessageStoreSession = null; try { if (this.needChangeMailboxSubtype) { if (this.originalRecipientTypeDetails == RecipientTypeDetails.UserMailbox) { MailboxTaskHelper.GrantPermissionToLinkedUserAccount(this.DataObject, PermissionTaskHelper.GetReadOnlySession(null), new Task.ErrorLoggerDelegate(base.WriteError), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose)); flag2 = true; flag3 = true; } else if (this.targetRecipientTypeDetails == RecipientTypeDetails.UserMailbox) { MailboxTaskHelper.ClearExternalAssociatedAccountPermission(this.DataObject, PermissionTaskHelper.GetReadOnlySession(null), new Task.ErrorLoggerDelegate(base.WriteError), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose)); flag = true; flag3 = true; } } else if (this.DataObject.IsChanged(ADRecipientSchema.MasterAccountSid)) { MailboxTaskHelper.GrantPermissionToLinkedUserAccount(this.DataObject, PermissionTaskHelper.GetReadOnlySession(null), new Task.ErrorLoggerDelegate(base.WriteError), new Task.TaskVerboseLoggingDelegate(base.WriteVerbose)); flag2 = true; flag3 = true; } base.InternalProcessRecord(); if (flag3) { PermissionTaskHelper.SaveMailboxSecurityDescriptor(this.DataObject, SecurityDescriptorConverter.ConvertToActiveDirectorySecurity(this.DataObject.ExchangeSecurityDescriptor), (IRecipientSession)base.DataSession, ref mapiMessageStoreSession, new Task.TaskVerboseLoggingDelegate(base.WriteVerbose), new Task.ErrorLoggerDelegate(base.WriteError)); } } finally { if (mapiMessageStoreSession != null) { mapiMessageStoreSession.Dispose(); } } if (flag2) { base.WriteVerbose(Strings.VerboseSaveADSecurityDescriptor(this.DataObject.Id.ToString())); this.DataObject.SaveSecurityDescriptor(((SecurityDescriptor)this.DataObject[ADObjectSchema.NTSecurityDescriptor]).ToRawSecurityDescriptor()); } bool flag4 = base.Fields.IsModified(ADUserSchema.SharingPolicy); if (this.RemoveManagedFolderAndPolicy || flag || flag4) { ADSessionSettings sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(base.RootOrgContainerId, base.CurrentOrganizationId, base.ExecutingUserOrganizationId, false); IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(base.DomainController, true, ConsistencyMode.IgnoreInvalid, sessionSettings, 4021, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\RecipientTasks\\mailbox\\SetMailbox.cs"); if (!tenantOrRootOrgRecipientSession.IsReadConnectionAvailable()) { tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(ConsistencyMode.IgnoreInvalid, sessionSettings, 4030, "InternalProcessRecord", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\RecipientTasks\\mailbox\\SetMailbox.cs"); } MailboxSession mailboxSession = this.OpenMailboxSession(tenantOrRootOrgRecipientSession, this.DataObject); if (mailboxSession == null) { base.WriteError(new RecipientTaskException(Strings.LogonFailure), ExchangeErrorCategory.ServerOperation, null); return; } using (mailboxSession) { if (this.RemoveManagedFolderAndPolicy && !ElcMailboxHelper.RemoveElcInMailbox(mailboxSession)) { this.WriteWarning(Strings.WarningNonemptyManagedFolderNotDeleted); } if (flag) { using (CalendarConfigurationDataProvider calendarConfigurationDataProvider = new CalendarConfigurationDataProvider(mailboxSession)) { CalendarConfiguration calendarConfiguration = (CalendarConfiguration)calendarConfigurationDataProvider.Read<CalendarConfiguration>(null); calendarConfiguration.AutomateProcessing = CalendarProcessingFlags.None; try { calendarConfigurationDataProvider.Save(calendarConfiguration); } catch (LocalizedException exception) { base.WriteError(exception, ExchangeErrorCategory.ServerOperation, null); } } } if (flag4) { mailboxSession.Mailbox.Delete(MailboxSchema.LastSharingPolicyAppliedId); mailboxSession.Mailbox.Delete(MailboxSchema.LastSharingPolicyAppliedHash); mailboxSession.Mailbox.Delete(MailboxSchema.LastSharingPolicyAppliedTime); mailboxSession.Mailbox.Save(); } } } if (base.IsSetRandomPassword) { MailboxTaskHelper.SetMailboxPassword((IRecipientSession)base.DataSession, this.DataObject, null, new Task.ErrorLoggerDelegate(base.WriteError)); } TaskLogger.LogExit(); }
// Token: 0x06000B78 RID: 2936 RVA: 0x0004A3E0 File Offset: 0x000485E0 public static bool DetailedCheckForAutomatedBooking(MapiEvent mapiEvent, MailboxSession itemStore, StoreObject item, CachedState cachedState) { bool isEventForConfigObject = CalendarConfigurationDataProvider.IsCalendarConfigurationClass(mapiEvent.ObjectClass) && item != null; return(ResourceCheck.InternalCheckForAutomaticBooking(isEventForConfigObject, itemStore, cachedState)); }
// Token: 0x06000B76 RID: 2934 RVA: 0x0004A35E File Offset: 0x0004855E public static bool IsEventConfigChange(MapiEvent mapiEvent) { return((mapiEvent.EventFlags & MapiEventFlags.FolderAssociated) != MapiEventFlags.None && CalendarConfigurationDataProvider.IsCalendarConfigurationClass(mapiEvent.ObjectClass)); }