protected override void InternalProcessRecord() { TaskLogger.LogEnter(); base.WriteVerbose(TaskVerboseStringHelper.GetDeleteObjectVerboseString(this.recipient.Identity, base.DataSession, typeof(ADMicrosoftExchangeRecipient))); base.DataSession.Delete(this.recipient); TaskLogger.LogExit(); }
private void RemoveMailUser() { if (this.mailUser == null) { this.WriteWarning(Strings.WarningJournalArchiveMailboxHasNoMailUser); return; } if (DisableJournalArchiving.ShouldSoftDeleteUser(this.mailUser)) { SoftDeletedTaskHelper.UpdateRecipientForSoftDelete(base.DataSession as IRecipientSession, this.mailUser, false); SoftDeletedTaskHelper.UpdateExchangeGuidForMailEnabledUser(this.mailUser); this.mailUser.JournalArchiveAddress = SmtpAddress.NullReversePath; base.WriteVerbose(TaskVerboseStringHelper.GetDeleteObjectVerboseString(this.mailUser.Identity, base.DataSession, typeof(ADUser))); try { try { RecipientTaskHelper.CreateSoftDeletedObjectsContainerIfNecessary(this.mailUser.Id.Parent, base.DomainController); base.DataSession.Save(this.mailUser); } catch (DataSourceTransientException exception) { base.WriteError(exception, ExchangeErrorCategory.ServerTransient, null); } return; } finally { base.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(base.DataSession)); } } base.WriteError(new RecipientTaskException(Strings.ErrorDisableJournalArchiveMailuserNotSoftDeleted), ExchangeErrorCategory.Client, this.mailUser.Identity); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(new object[] { this.RootId, this.DataObject }); try { base.WriteVerbose(TaskVerboseStringHelper.GetDeleteObjectVerboseString(this.dataObject.Identity, base.DataSession, typeof(TDataObject))); base.DataSession.Delete(this.dataObject); } catch (DataSourceTransientException exception) { base.WriteError(exception, ErrorCategory.WriteError, null); } catch (NullReferenceException innerException) { LocalizedException exception2 = new LocalizedException(Strings.ExceptionRemoveNoneExistenceObject, innerException); base.WriteError(exception2, ErrorCategory.WriteError, null); } finally { base.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(base.DataSession)); } TaskLogger.LogExit(); }
protected override void InternalProcessRecord() { TaskLogger.LogEnter(); bool flag = base.Fields.Contains("SoftDeletedObject"); if (base.IsVerboseOn) { base.WriteVerbose(TaskVerboseStringHelper.GetSaveObjectVerboseString(this.DataObject, base.DataSession, typeof(ADUser))); } if (this.WindowsLiveID != null && this.DataObject.NetID == null) { base.WriteError(new RecipientTaskException(Strings.ErrorMissingWindowsLiveIdHandler), ExchangeErrorCategory.ServerOperation, null); } try { if (base.IsDebugOn) { base.WriteDebug(Strings.DebugStartSaveDataObject); } base.DataSession.Save(this.DataObject); if (base.IsDebugOn) { base.WriteDebug(Strings.DebugEndSaveDataObject); } } finally { base.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(base.DataSession)); } bool flag2 = false; try { if (!flag) { this.StampChangesBeforeSettingPassword(); if (this.IsSetRandomPassword) { base.WriteVerbose(Strings.VerboseSettingPassword(this.DataObject.Id.ToString())); MailboxTaskHelper.SetMailboxPassword((IRecipientSession)base.DataSession, this.DataObject, null, new Task.ErrorLoggerDelegate(base.WriteError)); } else if (this.Password != null) { base.WriteVerbose(Strings.VerboseSettingPassword(this.DataObject.Id.ToString())); ((IRecipientSession)base.DataSession).SetPassword(this.DataObject, this.Password); } bool flag3 = base.Fields.IsModified(ADUserSchema.PasswordLastSetRaw) ? this.ResetPasswordOnNextLogon : this.DataObject.ResetPasswordOnNextLogon; bool bypassModerationCheck = this.DataObject.BypassModerationCheck; ADObjectId id = this.DataObject.Id; using (new CmdletMonitoredScope(base.CurrentTaskContext.UniqueId, "BizLogic", "DataSession.Read<ADUser>", LoggerHelper.CmdletPerfMonitors)) { this.DataObject = (ADUser)base.DataSession.Read <ADUser>(this.DataObject.Identity); } if (this.DataObject == null || this.DataObject.Id == null) { string id2 = (id == null) ? string.Empty : id.ToString(); base.WriteError(new RecipientTaskException(Strings.ErrorCreatedUserNotExist(id2)), ExchangeErrorCategory.ServerOperation, null); } this.DataObject.BypassModerationCheck = bypassModerationCheck; this.DataObject[ADUserSchema.PasswordLastSetRaw] = new long?(flag3 ? 0L : -1L); this.StampChangesAfterSettingPassword(); } base.InternalProcessRecord(); flag2 = !base.HasErrors; } finally { if (!flag2 && this.DataObject != null && this.DataObject.Id != null && !flag) { try { base.WriteVerbose(TaskVerboseStringHelper.GetDeleteObjectVerboseString(this.DataObject.Id, base.DataSession, typeof(ADUser))); base.DataSession.Delete(this.DataObject); } catch (DataSourceTransientException innerException) { base.WriteError(new RecipientTaskException(Strings.ErrorRemoveUserFailed(this.DataObject.Id.ToString()), innerException), ExchangeErrorCategory.ServerTransient, null); } finally { base.WriteVerbose(TaskVerboseStringHelper.GetSourceVerboseString(base.DataSession)); } } } TaskLogger.LogExit(); }