sharepoint 2010 provision a page using a feature

jackjohnson44 used Ask the Experts™
I want to simply provision a page with a stand alone project.  I have other projects that create custom master pages and everythign else.  I want a stand alone project which will simply create a page using my custom layout called MyLayout.  It can be blank, I really don't care.

I want to create a page called MyPage.aspx based on MyLayout.aspx.  The only thing in this project will be one feature that does this. The master page has already been deployed in another project.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

You can do it using a Module in Visual Studio 2010.
Create a new empty SharePoint project and add a new module.
Just like this:

Read more about modules you can here:


Thanks, I found that link too, but it doesn't apply.  That guy is also deploying a page along with his feature.  I only want to provision a page.  Have you done this before or did you just google it?  I have been searching for a while and can't find an answer.

I just want the xml needed to create a page, even if it uses an out of the box master page, layout or content type.  Every example that I see deploys a file in the same feature, which is not what I want to do.  I just want a project with a module containing a single Elements.xml file.  If I have to also unclude an aspx file, it is not correct.
So you want to create a page , not upload it?
Ok, then you can use a code to create a new page Like this:

I developed this kind of solution but never as a separate features.I'm always using the same feature and same module to provision pages and Web Parts to my site.


Thanks, but that isn't what I am looking for.  I just want xml to provision a page in the pages folder.  I don't care what kind of page it is.  Something out of the box would be fine.'

This doesn't work, but something like this
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="">
  <Module Name="HomePage" SetupPath="~\TEMPLATE\FEATURES\PublishingLayouts\PageLayouts" Url="Pages">
    <File Url="Contact.aspx" Type="GhostableInLibrary">
      <Property Name="Title" Value="Article Page" />
      <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/ArticleLeft.aspx, /_catalogs/masterpage/ArticleLeft.aspx;" />
      <Property Name="ContentType" Value="0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900242457EFB8B24247815D688C526CD44D" />

To the best of my knowledge it's not possible to provision a page using module without the physical page in your feature.
Like in this article:
The best way I know it's to create a page in the Feature Event Receiver.
Sorry if this doesn't help.
Hi! You can't do that using module. Module is for creating virtual path for physical file (stored on FS). But aspx files from Pages library (as for all other lists and libraries) are stored in content database. So if you want to create a new page in Pages library on feature activation, you should write code for that in feature receiver (as said above), because there is no way to do that using xml only.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial