A sharepoint page has markup and webparts zones inside the markup. When a user adds webparts to the web part zones, the markup for added webparts is not stored directly inside the page, but rather inside database tables. Hence the webpart markup can not be seen if users download a copy of the page, neither does sharepoint designer show webpart markup.
There are few situations when we need the webparts markup, e.g. copying page to some other farm, backup on local folder, etc. The blog at https://chuvash.eu/2014/09/19/export-any-web-part-from-a-sharepoint-page/ mentions several different ways to export webparts in a page, in particular I liked the idea of running javascript at https://github.com/mirontoli/sp-lend-id/blob/master/pajla/sp-export-webpart.js in console window.
However since my old days with SharePoint 2007 I know another method to export all webparts in a sharepoint page along with markup of the webpart page itself. Here it goes:
1) Open the document library (Pages library in most cases) in SharePoint designer
2) Copy the webpart page say page1.aspx and paste it, this creates a new webpart page with name like page1_copy(1).aspx
3) Right click on page1_copy(1).aspx and select "Detach from Page Layout" option
4) Click "Yes" to the dialog prompt
5) Right click on page1_copy(1).aspx and choose "Open" or "Edit file in Advanced Mode"
6) Copy contents and paste in a local file.
No comments:
Post a Comment