(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

  • Can you see the pages library document count and compare that with the number of documents that you actually see? – spevilgenius Jul 28 '10 at 17:58
up vote 1 down vote accepted

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>

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

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.