示例#1
0
        protected override void PrepareRecipientObject(ADUser user)
        {
            TaskLogger.LogEnter();
            ADUser aduser = this.mailboxPlanObject;

            if (aduser != null)
            {
                user.MailboxPlan = aduser.Id;
            }
            else if (user.MailboxPlan != null)
            {
                if (user.MailboxPlanObject != null)
                {
                    aduser = user.MailboxPlanObject;
                }
                else
                {
                    MailboxPlanIdParameter mailboxPlanIdParameter = new MailboxPlanIdParameter(user.MailboxPlan);
                    aduser = (ADUser)base.GetDataObject <ADUser>(mailboxPlanIdParameter, base.TenantGlobalCatalogSession, null, new LocalizedString?(Strings.ErrorMailboxPlanNotFound(mailboxPlanIdParameter.ToString())), new LocalizedString?(Strings.ErrorMailboxPlanNotUnique(mailboxPlanIdParameter.ToString())), ExchangeErrorCategory.Client);
                }
                this.mailboxPlanObject = aduser;
            }
            user.MailboxPlanObject = null;
            user.propertyBag.ResetChangeTracking(ADRecipientSchema.MailboxPlanObject);
            if (aduser != null)
            {
                using (new CmdletMonitoredScope(base.CurrentTaskContext.UniqueId, "BizLogic", "NewMailboxOrSyncMailbox.PrepareRecipientObject", LoggerHelper.CmdletPerfMonitors))
                {
                    ADUser aduser2 = new ADUser();
                    aduser2.StampPersistableDefaultValues();
                    aduser2.StampDefaultValues(RecipientType.UserMailbox);
                    aduser2.ResetChangeTracking();
                    User.FromDataObject(aduser2).ApplyCloneableProperties(User.FromDataObject(aduser));
                    Mailbox.FromDataObject(aduser2).ApplyCloneableProperties(Mailbox.FromDataObject(aduser));
                    CASMailbox.FromDataObject(aduser2).ApplyCloneableProperties(CASMailbox.FromDataObject(aduser));
                    UMMailbox.FromDataObject(aduser2).ApplyCloneableProperties(UMMailbox.FromDataObject(aduser));
                    bool            litigationHoldEnabled = user.LitigationHoldEnabled;
                    ElcMailboxFlags elcMailboxFlags       = user.ElcMailboxFlags;
                    user.CopyChangesFrom(aduser2);
                    if (base.SoftDeletedObject != null)
                    {
                        if (litigationHoldEnabled != user.LitigationHoldEnabled)
                        {
                            user.LitigationHoldEnabled = litigationHoldEnabled;
                        }
                        if (elcMailboxFlags != user.ElcMailboxFlags)
                        {
                            user.ElcMailboxFlags = elcMailboxFlags;
                        }
                    }
                }
            }
            base.PrepareRecipientObject(user);
            MailboxTaskHelper.WriteWarningWhenMailboxIsUnlicensed(user, new Task.TaskWarningLoggingDelegate(this.WriteWarning));
            TaskLogger.LogExit();
        }
示例#2
0
		protected override IConfigurable ConvertDataObjectToPresentationObject(IConfigurable dataObject)
		{
			return Mailbox.FromDataObject((ADUser)dataObject);
		}