1

I am looking for a way to deploy a custom page to sharepoint.

Currently I was able to do it via sharepoint, by adding an aspx page to the project. This added an aspx pages to layouts and it deployed it to sharepoint.

The page page did work, but I was unable to make it the welcome page. It seems that the welcome page can be only a page that resides in "SitePages" directory.

So how could I deploy to SitePages a page via visual studio?

I am using Sharepoint 2013 with visual studio 2012.

1 Answer 1

2

The page can be deployed to Site Pages library using module. Sample module file code:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="Webpartpage" Url="SitePages">
    <File Path="Webpartpage\MyPage.aspx" Url="MyPage.aspx"  
          Type="GhostableInLibrary" IgnoreIfAlreadyExists="FALSE">
      <AllUsersWebPart WebPartOrder ="0" WebPartZoneID ="wpzMyZone">
        <![CDATA[ 
          <webParts>
            <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
              <metaData>
                <type name="WebpartPages.MyWebpart.MyWebpart, WebpartPages, 
                Version=1.0.0.0, Culture=neutral, PublicKeyToken=132122a1200767d5" />
                <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
              </metaData>
              <data>
                <properties>
                  <property name="Title" type="string">MyWebpart</property>
                  <property name="Description" type="string">Mywebpart</property>

                </properties>
              </data>
            </webPart>
          </webParts>
        ]]>
      </AllUsersWebPart>
    </File>
  </Module>
</Elements>

Check Deploy webpart page using module for more information

1
  • 1
    Thank you. your solution lead me to blogs.msmvps.com/windsor/2013/08/20/… which was a bit easier to implement, but your is also useful, so I will accept and upvote your answer.
    – user42703
    Jun 15, 2015 at 11:21

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.