开发者

MOSS 2007 - Custom Aspx Pages Created With Feature

(I have also asked this question on SharePoint Overflow.)

I have a SharePoint feature I'm using to add some custom aspx files to the Pages Library.

When I activate the feature, I can visit the pages in-browser and they are visible in SPDesigner, but when I "View All Site Content" they are not there.

Why is this the case?

The Feature's Elements File:

<?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>

The Aspx File:

<%@ 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 -->

(yup, it's empty!)

Addendum

When I "visit the pages in-browser" I mean navigate to their URLs manually: http://myserver:PORT/subsite/Pages/Example.aspx

When I "View All Site Content" I am looking at the contents of the "Pages" list: http://myserver:PORT/subsite/Pages/Forms/AllItems.aspx


I got an answer on SharePoint Overflow:

The File Node should have Type="GhostableInLibrary", because "Pages" is a document library. When ever you provision a file in a document library you need to have ghostableinlibrary set.

eg:


<?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>

So in the end the XML I'm using is...

<?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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜