MOSS 2007 - 使用功能创建的自定义Aspx页面

时间:2010-07-28 15:23:58

标签: sharepoint sharepoint-2007 asp.net

(我也在SharePoint Overflow上提出了这个问题。)

我有一个SharePoint功能,我用它来向页面库添加一些自定义的aspx文件。

当我激活该功能时,我可以访问浏览器中的页面,它们在SPDesigner中可见,但当我“查看所有网站内容”时,它们不在那里。

为什么会这样?

要素的元素文件:

<?xml version="1.0" encoding="utf-8"?>
<Elements Id="9e85eb79-6d8d-4ff3-b0d4-64d55c3bb577" xmlns="http://schemas.microsoft.com/sharepoint/">
    <Module Name="Pages" Url="Pages">
        <File Path="Example.aspx" Url="Example.aspx" IgnoreIfAlreadyExists="False">
            <Property Name="Title" Value="The Example" />
            <Property Name="ContentType" Value="Page" />
        </File>
    </Module>
</Elements>

Aspx文件:

<%@ Page language="C#" Inherits="System.Web.UI.Page,System.Web,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" MasterPageFile="~masterurl/default.master"%>
<%-- deliberately left empty -->

(是的,它是空的!)

附录

当我“浏览浏览器中的网页”时,我的意思是手动导航到他们的网址:http://myserver:PORT/subsite/Pages/Example.aspx

当我“查看所有网站内容”时,我正在查看“页面”列表的内容:http://myserver:PORT/subsite/Pages/Forms/AllItems.aspx

1 个答案:

答案 0 :(得分:0)

我得到了有关SharePoint Overflow的答案:

文件节点应具有Type =“GhostableInLibrary”,因为“Pages”是文档库。如果您在文档库中配置文件,则需要设置ghostableinlibrary。

例如:


<?xml version="1.0" encoding="utf-8"?>
    <Elements Id="9e85eb79-6d8d-4ff3-b0d4-64d55c3bb577" xmlns="http://schemas.microsoft.com/sharepoint/">
    <Module Name="Pages" Url="Pages">
        <File Path="Example.aspx" Url="Example.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="False">
            <Property Name="Title" Value="The Example" />
            <Property Name="ContentType" Value="Page" />
        </File>
    </Module>
</Elements>

所以最后我使用的XML是......

<?xml version="1.0" encoding="utf-8"?>
<Elements Id="9e85eb79-6d8d-4ff3-b0d4-64d55c3bb577" xmlns="http://schemas.microsoft.com/sharepoint/">
    <Module Name="Pages" Url="Pages">
        <File Path="Example.aspx" Url="Example.aspx" IgnoreIfAlreadyExists="False" Type="GhostableInLibrary">
            <Property Name="Title" Value="The Example" />
        </File>
    </Module>
</Elements>
相关问题