1

I have an existing Visual Studio solution containing web parts etc.

I want to add a set of site pages to the solution, that will be deployed to the 'SitePages' folder of a site collection, when the solution is deployed.

How would I do that?

1 Answer 1

0

This link helped me with this back when I tried this with SharePoint 2013 (similar to how it's done in SP2010): http://blogs.msdn.com/b/kaevans/archive/2010/06/28/creating-a-sharepoint-site-page-with-code-behind-using-visual-studio-2010.aspx

Steps:

  1. add VS 2012 project
  2. add module
    enter image description here
  3. add aspx to module (like in link above), you can copy page content from SharePoint designer after creating a site page there
  4. edit Elements.xml (in module) like so:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="SitePagesModule" Url="SitePages">
    <File Path="SitePagesModule\SitePages\page1.aspx" Url="SitePagesModule/page1.aspx" Type="GhostableInLibrary" />
    <File Path="SitePagesModule\SitePages\page2.aspx" Url="SitePagesModule/page2.aspx" Type="GhostableInLibrary" />
  </Module>
</Elements>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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