I am aware of how to create a page in Sharepoint declaratively, via markup, like so:
<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <Module Name="Pages" Url="Pages" Path="PageLayouts"> <File Url="Connection Test.aspx" Type="GhostableInLibrary" Path="PageLayout.aspx"> <AllUsersWebPart WebPartOrder="1" WebPartZoneID="RightColumn" ID="Provider">...</AllUsersWebPart> <AllUsersWebPart WebPartOrder="2" WebPartZoneID="Body" ID="Consumer">...</AllUsersWebPart> <Property Name="Title" Value="Connection Test" /> <Property Name="ContentType" Value="Page" /> </File> </Module> </Elements>
But I'm interested in the reverse process -- how can I obtain this code for a page that already exists in my 'Pages' library? I tried downloading a copy of the page, and also opening it in Sharepoint Designer, but all I see is the ASPX code of the page. I'm interested in the XML markup code that generated that page. Is there a way?
UPDATE: Clarifying the question a little more:
- I first create a simple web-part page from the Sharepoint UI, via
Site Actions > More Options > Web Part Page. I then give it a name (say
TestPage.aspx), and select the Document Library (say
Pages) to save the page in.
- Next, I add web parts to the page.
- Also, I establish web part connections, if any.
- And then, hit
Stop Editingto save the page.
So now the page
TestPage.aspx is available in
Pages library. To view the code behind the page, I click on the page, and choose
Download a copy (or alternatively, right-click the page, and choose
Edit in Microsoft Sharepoint Designer), but all I see here is the ASPX code that doesn't include any XML markup like the one above.
If it's possible to write XML to create a page (like the example above), I'm guessing there's a way I can look at how the XML for the web parts and web part connections are coded by Sharepoint when a page is created manually. How do I get this XML?