Search

rafelo

Advancing Productivity and Operational Efficiency through Cloud Services and Apps

Month

March 2009

Easily determine your sites Content Database with a Custom Application Page

During last nights presentation at the Houston’s SharePoint Users Group I demonstrated how to create a simple application page to determine the Content Database of any SharePoint site. While I have posted a link to the presentation in my previous post, I think the Application Page may be very useful to many and have decided to post it here to make it easier to find.

The application page looks as follows and is easily accessible on any site by appending “/_layouts/ShowContentDatabase.aspx” to the URL of the SharePoint site: 

image

Creating the Application Page is very simple.

  1. Go to your LAYOUTS folder, usually located in “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS”
  2. Create a new file named “ShowContentDatabase.aspx”
  3. Add the following code the your file and save your changes.
<%@ Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, 
Culture=neutral, PublicKeyToken=71e9bce111e9429c"
%>
<%@ Page Language="C#" MasterPageFile="~/_layouts/application.master"
Inherits="Microsoft.SharePoint.WebControls.LayoutsPageBase" %>
<%@ Import Namespace="Microsoft.SharePoint" %>

<script runat="server">
protected override void OnLoad(EventArgs e)
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
lblContentDatabase.Text = SPContext.Current.Site.ContentDatabase.Name;
});
}


<asp:content id="PageTitle" runat="server" contentplaceholderid="PlaceHolderPageTitle">
Content Database


<asp:content id="PageTitleInTitleArea" runat="server" contentplaceholderid="PlaceHolderPageTitleInTitleArea">
Content Database


<asp:content id="Main" runat="server" contentplaceholderid="PlaceHolderMain">
Content Database: <asp:Label ID="lblContentDatabase" runat="server" />

That’s it. The page should be saved to the LAYOUTS folder in each of your Web Front End (WFE) servers.. I would recommend packaging the page in a WSP file and deploying it that way if you have the time.

digg_url = “https://blog.rafelo.com/2009/03/easily-determine-your-sites-content.html&#8221;;digg_title = “Easily determine your sites Content Database with a Custom Application Page”;digg_bgcolor = “#FFFFFF”;digg_skin = “compact”;digg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;

Custom SharePoint Application Pages and the Menu System

Last night in Houston’s SharePoint Users Group (HSPUG) I gave a short presentation / introduction on Custom Application Pages and how to add items to the SharePoint menu system. During the presentation we discussed what application pages are, when to use them, and demonstrated how to create a simple application page and add it to the site settings menu. All of the information is contained in the presentation which can be downloaded here.

digg_url = “https://blog.rafelo.com/2009/03/custom-sharepoint-application-pages-and.html&#8221;;digg_title = “Custom SharePoint Application Pages and the Menu System”;digg_bgcolor = “#FFFFFF”;digg_skin = “compact”;digg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;

Blog at WordPress.com.

Up ↑

%d bloggers like this: