コード例 #1
0
        public ActionResult RemoveMailbox(FormCollection _POST)
        {
            try
            {
                model.Mailbox.Organization      = _POST["organization"];
                model.Mailbox.UserPrincipalName = _POST["identity"];

                CommonCAS.Log(string.Format("has run Mail/RemoveMailbox for {0}\\{1}", model.Mailbox.Organization, model.Mailbox.UserPrincipalName));

                using (MyPowerShell ps = new MyPowerShell())
                {
                    ps.RemoveMailbox(model.Mailbox).Invoke();
                }

                CommonCAS.Stats("Mail/RemoveMailbox");

                model.OKMessage.Add(string.Format("{0}\\{1} was deleted successfully. It can take up to 30 seconds for the mailbox to disappear from SelfService.", model.Mailbox.Organization, model.Mailbox.UserPrincipalName));

                return(View("RemoveMailbox", model));
            }
            catch (Exception exc)
            {
                CommonCAS.Log("Exception: " + exc.Message);
                model.ActionFailed = true;
                model.Message      = exc.Message;
                return(View("RemoveMailbox", model));
            }
        }