Pagina aspx base per SharePoint 2007
Di seguito è mostrato il file WebInfo.aspx (_layouts), un esempio di pagina per SharPoint 2007 (WSS3 - MOSS), che elenca alcune caratteristiche del sito corrente.
Va richiamata con
Va richiamata con
URL
http://<macchinaSharePoint>/_layouts/Sgart/WebInfo.aspx
C#: WebInfo.aspx
<%@ 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)
{
SPWeb web = this.Web;
lblTitle.Text = web.Title;
lblDescription.Text = web.Description;
lblUrl.Text = web.Url;
lblLists.Text = web.Lists.Count.ToString();
lblFiles.Text = web.Files.Count.ToString();
lblUsers.Text = web.Users.Count.ToString();
lblRecycleBin.Text = web.RecycleBin.Count.ToString();
lblContentTypes.Text = web.ContentTypes.Count.ToString();
lblCurrentUser.Text = web.CurrentUser.LoginName;
lblMasterUrl.Text = web.MasterUrl;
lblCurrencyLocaleID.Text = web.CurrencyLocaleID.ToString();
lblCreated.Text = web.Created.ToString();
lblWebs.Text = web.Webs.Count.ToString();
}
</script>
<asp:Content ID="Main" runat="server" ContentPlaceHolderID="PlaceHolderMain">
<table border="1" cellpadding="4" cellspacing="0">
<tr>
<td>Title</td>
<td><asp:Label ID="lblTitle" runat="server" /></td>
</tr>
<tr>
<td>Description</td>
<td><asp:Label ID="lblDescription" runat="server" /></td>
</tr>
<tr>
<td>Url</td>
<td><asp:Label ID="lblUrl" runat="server" /></td>
</tr>
<tr>
<td>Lists </td>
<td><asp:Label ID="lblLists" runat="server" /></td>
</tr>
<tr>
<td>Files</td>
<td><asp:Label ID="lblFiles" runat="server" /></td>
</tr>
<tr>
<td>Users</td>
<td><asp:Label ID="lblUsers" runat="server" /></td>
</tr>
<tr>
<td>RecycleBin</td>
<td><asp:Label ID="lblRecycleBin" runat="server" /></td>
</tr>
<tr>
<td>ContentTypes</td>
<td><asp:Label ID="lblContentTypes" runat="server" /></td>
</tr>
<tr>
<td>CurrentUser</td>
<td><asp:Label ID="lblCurrentUser" runat="server" /></td>
</tr>
<tr>
<td>MasterUrl</td>
<td><asp:Label ID="lblMasterUrl" runat="server" /></td>
</tr>
<tr>
<td>CurrencyLocaleID</td>
<td><asp:Label ID="lblCurrencyLocaleID" runat="server" /></td>
</tr> <tr>
<td>Created</td>
<td><asp:Label ID="lblCreated" runat="server" /></td>
</tr>
<tr>
<td>Webs</td>
<td><asp:Label ID="lblWebs" runat="server" /></td>
</tr>
</table>
</asp:Content>
<asp:Content ID="PageTitle" runat="server"
ContentPlaceHolderID="PlaceHolderPageTitle">
Web Info
</asp:Content>
<asp:Content ID="PageTitleInTitleArea" runat="server"
ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea">
More info on current web
</asp:Content>
La pagina va copiata in "%programfiles%\common files\microsoft shared\web server extensions\12\TEMPLATE\LAYOUTS\Sgart"