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);
 }
Esempio n. 2
0
 protected override void InternalProcessRecord()
 {
     if (Globals.IsMicrosoftHostedOnly)
     {
         ADUser dataObject = base.DataObject;
         if (this.ShouldSoftDeleteObject())
         {
             SoftDeletedTaskHelper.UpdateRecipientForSoftDelete(base.DataSession as IRecipientSession, dataObject, this.ForReconciliation);
             SoftDeletedTaskHelper.UpdateExchangeGuidForMailEnabledUser(dataObject);
         }
         else
         {
             dataObject.RecipientSoftDeletedStatus = 0;
         }
     }
     base.InternalProcessRecord();
 }
Esempio n. 3
0
        protected override IConfigurable PrepareDataObject()
        {
            TaskLogger.LogEnter();
            ADUser aduser = (ADUser)base.PrepareDataObject();

            if (aduser.IsChanged(MailUserSchema.WindowsLiveID))
            {
                SmtpAddress value = (SmtpAddress)aduser.GetOriginalObject()[MailUserSchema.WindowsLiveID];
                if (value != SmtpAddress.Empty && !aduser.EmailAddresses.Contains(ProxyAddress.Parse("smtp", value.ToString())))
                {
                    aduser.EmailAddresses.Add(ProxyAddress.Parse("smtp", value.ToString()));
                }
            }
            if (VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Global.MultiTenancy.Enabled)
            {
                if (aduser.IsChanged(ADRecipientSchema.ExternalEmailAddress))
                {
                    MailUserTaskHelper.ValidateExternalEmailAddress(aduser, this.ConfigurationSession, new Task.ErrorLoggerDelegate(base.WriteError), base.ProvisioningCache);
                }
                if (VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Global.WindowsLiveID.Enabled)
                {
                    if (aduser.WindowsLiveID != SmtpAddress.Empty && !aduser.WindowsLiveID.Equals(aduser.UserPrincipalName))
                    {
                        aduser.UserPrincipalName = aduser.WindowsLiveID.ToString();
                    }
                }
                else if (!aduser.IsModified(ADUserSchema.UserPrincipalName))
                {
                    aduser.UserPrincipalName = aduser.PrimarySmtpAddress.ToString();
                }
                if (this.DataObject.IsSoftDeleted && this.DataObject.IsModified(MailUserSchema.ExchangeGuid))
                {
                    SoftDeletedTaskHelper.UpdateExchangeGuidForMailEnabledUser(this.DataObject);
                }
                if ((aduser.IsChanged(ADUserSchema.LitigationHoldEnabled) && aduser.LitigationHoldEnabled) || (aduser.IsChanged(ADRecipientSchema.InPlaceHoldsRaw) && aduser.IsInLitigationHoldOrInplaceHold) || (aduser.IsChanged(ADUserSchema.ElcMailboxFlags) && aduser.LitigationHoldEnabled))
                {
                    RecoverableItemsQuotaHelper.IncreaseRecoverableItemsQuotaIfNeeded(aduser);
                }
            }
            TaskLogger.LogExit();
            return(aduser);
        }