Enumerate Installed Features in the Farm
TreeView TreeView1 = new TreeView(); TreeView1.Nodes.Add(new TreeNode("Features")); SPSecurity.RunWithElevatedPrivileges(delegate() //get the name of the current web in current user's context string spSiteURL = SPControl.GetContextSite(Context).Url.ToString(); //Initialize the spweb object using the elevated privileges #region Return Installed Features. oFSiteNode = new TreeNode("All Farm Installed Features"); SPFarm oFarm = oSite.WebApplication.Farm; SPFeatureDefinitionCollection oFeatDefColl = oFarm.FeatureDefinitions; TreeView1.Nodes[1].ChildNodes.Add(oFSiteNode); #endregion TreeView1.CollapseAll(); } } |
0 comments:
Post a Comment