代码之家  ›  专栏  ›  技术社区  ›  Richard JP Le Guen

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

  •  1
  • Richard JP Le Guen  · 技术社区  · 14 年前

    (我也问过这个问题 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 -->
    

    (是的,它是空的!)

    当我“在浏览器中访问页面”时,我的意思是手动导航到它们的URL: http://myserver:PORT/subsite/Pages/Example.aspx

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

    1 回复  |  直到 7 年前
        1
  •  0
  •   Richard JP Le Guen    14 年前

    文件节点应该具有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 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>