예제 #1
0
        public static dynamic GetSitesHierarquia()
        {
            try
            {
                Connection connection = Connection.Instance;
                connection.ConnectionString = VisualWebPart1._connectionString;
                connection.User             = VisualWebPart1._username;
                connection.Password         = VisualWebPart1._password;

                IApplicationFacade application = new ApplicationFacade();
                var list = new List <Site>();

                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    list = application.GetSites(connection);
                });

                return(JsonConvert.SerializeObject(
                           list, new JsonSerializerSettings
                {
                    ContractResolver = new CamelCasePropertyNamesContractResolver()
                }));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }