コード例 #1
0
        public string GetMailforward(string organization, string userprincipalname)
        {
            try
            {
                using (MyPowerShell ps = new MyPowerShell())
                {
                    ps.GetMailforward(organization, userprincipalname);
                    PSObject result = ps.Invoke().Single();

                    return(new JavaScriptSerializer().Serialize(new AjaxMailForward()
                    {
                        Organization = result.Members["Organization"].Value.ToString(),
                        UserPrincipalName = result.Members["UserPrincipalName"].Value.ToString(),
                        Name = result.Members["Name"].Value.ToString(),
                        ForwardingAddress = result.Members["ForwardingAddress"].Value.ToString(),
                        DeliverToMailboxAndForward = bool.Parse(result.Members["DeliverToMailboxAndForward"].Value.ToString())
                    }));
                }
            }
            catch (Exception exc)
            {
                return(new JsonException(exc).ToString());
            }
        }