コード例 #1
0
        public string GetADUsersProxy(string organization, string userprincipalname)
        {
            try
            {
                List <AjaxADUser> users = new List <AjaxADUser>();

                using (MyPowerShell ps = new MyPowerShell())
                {
                    ps.GetADUsers(organization, userprincipalname);
                    IEnumerable <PSObject> result = ps.Invoke();

                    foreach (PSObject User in result)
                    {
                        Dictionary <string, object> properties = CommonCAS.GetPSObjectProperties(User);
                        users.Add(new AjaxADUser()
                        {
                            proxyAddresses = properties["proxyAddresses"].ToString().Split(','),
                        });
                    }
                }

                return(new JavaScriptSerializer().Serialize(users));
            }
            catch (Exception exc)
            {
                return(new JsonException(exc).ToString());
            }
        }