Question

(I have also asked this question on Stack 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

Was it helpful?

Solution

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>

OTHER TIPS

What is the URL you are using to 'view the pages in-browser'?
What is the URL you are using when you 'View All Site Content"?

 Tim
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top