博客地址 http://blog.csdn.net/foxdave

本文叙述如何自定义SharePoint的固有页面,比较简单,用一句话说就是“做个页面,写一句代码。”

创建SharePoint空解决方案,添加Layouts映射文件夹,添加页面文件error.aspx和signout.aspx。

error.aspx

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="error.aspx.cs" Inherits="CustomPages.error"
DynamicMasterPageFile="~masterurl/default.master" %> <asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
</asp:Content>
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
出现错误,请联系管理员
<!--自定义错误页面,在此页面写代码-->
</asp:Content>
<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
应用程序页
</asp:Content>
<asp:Content ID="PageTitleInTitleArea" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea"
runat="server">
我的应用程序页
</asp:Content>

signout.aspx

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="signout.aspx.cs" Inherits="CustomPages.signout"
MasterPageFile="~/_layouts/simple.master" %> <asp:Content ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
<SharePoint:EncodedLiteral runat="server" Text="<%$Resources:wss,signout_pagetitle%>"
EncodeMethod='HtmlEncode' />
</asp:Content>
<asp:Content ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server">
<SharePoint:EncodedLiteral runat="server" Text="<%$Resources:wss,signout_pagetitle%>"
EncodeMethod='HtmlEncode' />
</asp:Content>
<asp:Content ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
<script type="text/javascript">
function ULSd63() { var o = new Object; o.ULSTeamName = "Microsoft SharePoint Foundation"; o.ULSFileName = "SignOut.aspx"; return o; }
function _spBodyOnLoad() {
ULSd63: ;
window.close();
}
</script>
</asp:Content>
<asp:Content ContentPlaceHolderID="PlaceHolderMain" runat="server">
<asp:Label ID="lbPageDescription" Text="<%$Resources:wss,signout_pagedescription%>"
runat="server" />
</asp:Content>

自定义页面的好处是可以处理一些自己实际中需要的操作。

然后添加feature,激活和取消激活事件

public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPWebApplication webApp = properties.Feature.Parent as SPWebApplication;
if (null != webApp)
{
webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.Error, "/_layouts/SP_MIP/CustomPages/error.aspx");
webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.Signout, "/_layouts/SP_MIP/CustomPages/signout.aspx");
webApp.Update(true);
}
} public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
{
SPWebApplication webApp = properties.Feature.Parent as SPWebApplication;
if (null != webApp)
{
webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.Error, null);
webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.Signout, null);
webApp.Update(true);
}
}

核心就一句话

webApp.UpdateMappedPage(SPWebApplication.SPCustomPage.Error,"/_layouts/SP_MIP/CustomPages/error.aspx");

有这些页面可以自定义

SharePoint开发 - 自定义页面(错误页、登出页)的更多相关文章

  1. sharepoint 2010 自定义页面布局

    在sharepoint开发中经常遇到 自定义网站栏.内容类型,页面布局和模板页也会遇到,遇到机会就相对比较小. 首先新建一个空的sharepoint项目: 1)创建网站兰: 修改SiteColumns ...

  2. .net开发---自定义页面打印区域

    自定义页面打印区域 有3种办法: 办法一:将不需要打印的部位隐藏掉 Examp: <%-- (1)使用css样式,定义一个.noprint的class,将不打印的内容放入这个class内. -- ...

  3. 错误:当你使用id作为sharepoint的自定义页面的查询参数时,总会提示项目不存在!

    No item exists at http://SERVER/SITE/mypage.aspx?ID=1. It may have been deleted or renamed by anothe ...

  4. SharePoint 2010 自定义页面出现“项目可能已被其他用户删除或重命名”问题跟踪

    异常详细信息: Microsoft.SharePoint.SPException: 位置 http://portal/Pages/ShowArticle.aspx?id=19&mylist=8 ...

  5. SharePoint开发 - 自定义导航菜单(一)菜单声明与配置

    博客地址 http://blog.csdn.net/foxdave 本篇描述自定义sharepoint菜单的一种方式,自定义菜单适用于一些门户等需求的网站 自定义的菜单有自己的数据源,可以是数据表,可 ...

  6. SharePoint开发 - 自定义导航菜单(二)母版页的菜单应用

    博客地址 http://blog.csdn.net/foxdave 接上篇点击打开链接 本篇叙述在母版页中应用之前的配置信息生成菜单,主要涉及到母版页的自定义,并应用了第三方控件库DevExpress ...

  7. SharePoint开发 - 自定义导航菜单(三)附其他代码

    博客地址 http://blog.csdn.net/foxdave 接上篇点击打开链接 LeftNavGroupTemplate.cs internal class LeftNavGroupTempl ...

  8. CAS学习笔记五:SpringBoot自动/手动配置方式集成CAS单点登出

    本文目标 基于SpringBoot + Maven 分别使用自动配置与手动配置过滤器方式实现CAS客户端登出及单点登出. 本文基于<CAS学习笔记三:SpringBoot自动/手动配置方式集成C ...

  9. 从零搭建一个IdentityServer——会话管理与登出

    在上一篇文章中我们介绍了单页应用是如何使用IdentityServer完成身份验证的,并且在讲到静默登录以及会话监听的时候都提到会话(Session)这一概念,会话指的是用户与系统之间交互过程,反过来 ...

随机推荐

  1. 熟练使用git命令

    git工作流程图: 下面是我整理的常用 Git 命令清单.几个专用名词的译名如下: Workspace:工作区 Index / Stage:暂存区 Repository:仓库区(或本地仓库) Remo ...

  2. association ,collection

    mybatis 出现这个错误Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 2 ...

  3. DispatcherServlet默认配置

    DispatcherServlet的默认配置在DispatcherServlet.properties(和DispatcherServlet类在一个包下)中,而且是当Spring配置文件中没有指定配置 ...

  4. IE6 IE7 hasLayout bug之li间的3px垂直间距

    1. li中仅包含a,span等内联(行内)元素2.触发条件: li元素的layout被触发(通常为设置了宽或高,设置overflow:hidden在IE7下同样触发layout),且a或span元素 ...

  5. Shell基础:变量类型 & 运算符

    Shell变量 Shell支持三种类型的变量 用户自定义变量:用户自定义的变量,变量名以英文字母或下划线开头,区分大小写. 位置变量:根据位置传递参数给脚本的变量,默认支持9个位置变量 $1,$2,$ ...

  6. win7开启硬盘AHCI

    问题描述:装win7的时候没有在AHCI模式下安装,而是在IDE模式下安装的,后来安装完毕以后想更改成AHCI模式,可是更改以后启动电脑蓝屏并重启 解决方法: 如果是在IDE模式下安装的系统,由于在安 ...

  7. hdu-------1081To The Max

    To The Max Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

  8. jquery 实现 点击按钮后倒计时效果,多用于实现发送手机验证码、邮箱验证码

    原文链接:http://www.cnblogs.com/steed-zgf/archive/2012/02/03/2336984.html <!DOCTYPE html PUBLIC " ...

  9. IO流--字节流

    import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import ...

  10. content.boundingRectWithSize计算出来的高度不准

      计算出来的高度会少一行的高度,最后一行会显示不全.减掉padding会解决这个问题.   let padding = self.reviewText.textContainer.lineFragm ...