AdministrationDataSource Control
The AdministrationDataSourceControl control can be used on custom application pages that are deployed to the Central Administration. It allows for retrieval of solutions, content databases,
Following pictures shows the information of the retrieved solutions:
The basic syntax is as follows:
<spuc:AdministrationDataSourceControl ID="SolutionsDS" runat="server" ViewName="Solutions" />
If you want to retrieve information about solutions you have to set the ViewName property to Solutions. Other possible values are:
- ContentDatases
- JobDefinitions
- RunningJobs
- Policy
- SelectService
- SiteDetail
- SelectWebApplication
Add the following code to display the data in a grid view:
<asp:GridView RowStyle-CssClass="ms-authoringcontrols" id="SolutionsGridView" runat="server" AutoGenerateColumns="true" width="100%" AllowSorting="True" DataSourceId="SolutionsDS" />
It resides in the Microsoft.SharePoint.WebControls namespace of the Microsoft.SharePoint.ApplicationPages.Administration.dll. This assembly is deployed to the 12\CONFIG\ADMINBIN directory. As this assembly is not deployed to the Global Assembly Cache, you don’t have to reference the strong name in the page directive:
<%@ Register TagPrefix="spuc" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint.ApplicationPages.Administration" %>
The conrol is not very flexible. If you choose to retrieve information about solutions, you only get information about Name, SolutionLink (directing you to the SolutionStatus.aspx page), Status, HtmlStatus and Deployed properties back, whereas an object of type SPSolution has other very important properties like SolutionId, Version, ContainsCasPolicy, ContainsGlobalAssembly and many others.
If you opt for JobDefinitions, returned properties are Name, a link to the JobEdit.aspx page with the JobId in the querystring, the scope and the schedule.
Setting the ViewName property to RunningJobs returns the Name, the server on which the job runs, the DateTime of the last run, the status and the progress.
Setting the ViewName property to SelectService returns data about the SharePoint services.
Setting the ViewName property to SelectWebApplication returns you information about the SharePoint web applications
This control should also be able to return information about upgraded databases and upgraded sites, but I was not able to test that out.
You can combine the AdministrationDataSourceControl with an SPGridView control but in that case you have to set the AutoGenerateColumns property to false and specify a template with the necessary columns:
<spuc:SPGridView id="SolutionsGridView" runat="server" width="100%" AutoGenerateColumns="false" AllowSorting="True" DataSourceId="SolutionsDS" > <AlternatingRowStyle CssClass="ms-alternating" /> <EmptyDataTemplate> <spuc:EncodedLiteral runat="server" text="<%$Resources:spadmin, solutions_empty1%>" EncodeMethod='HtmlEncode'/> </EmptyDataTemplate> <Columns> <asp:TemplateField SortExpression="ItemName" HeaderText="Solution name"> <ItemStyle VerticalAlign="Top" /> <ItemTemplate> <%# @"<a href='" + SPHttpUtility.HtmlUrlAttributeEncode(Eval("SolutionLink").ToString()) + "'>" + SPHttpUtility.HtmlEncode(Eval("ItemName").ToString()) + @"</a>" %> </ItemTemplate> </asp:TemplateField> <asp:BoundField HeaderText="Status" DataField="HtmlStatus" HtmlEncode="false" SortExpression="Status" /> <asp:BoundField HeaderText="Deployed" DataField="Deployed" HtmlEncode="true" /> </Columns> </SharePoint:SPGridView>
Hello,
The intro specifies that the control AdministrationDataSourceControl can be used in custom application pages deployed to the Central Administration but
is it ok to use it in a webpart to deploy on any other site page without permissions problems ?
Comment by Florent | August 31, 2010 |
I’m not sure of that. You should try it out.
Karine
Comment by Karine Bosch | September 6, 2010 |