0

Can anyone please suggest how to convert a SharePoint 2013 wiki page to XML and vice a verse, i.e. xml to the sharepoint wiki page?

1 Answer 1

0

Using the Solution

Once deployed you need to activate the feature "Page Manifest Extractor", which is a Web-Scoped Feature. This feature as mentioned earlier adds a few ribbon buttons on the Sharepoint Ribbon under the Group “Developer”. These specifically placed ribbon button are at

Extract Manifest: Page Tab of a Wiki Page (Image: Wiki Page Button Below) All Manifests: Library Tab or Pages Library (Image: Pages Library Button Below)

enter image description here

The Extract Manifest button as pointed in the image above extracts the feature manifest for the Wiki Page in context. Once clicked this will open a Sharepoint Modal Pop up, which points to an application page which is of the url “http:///_layouts/15/PageManifestExtractor/PageManifest.aspx”. This application page in a Wiki-Page Context takes a query string parameter PageUrl which is either the full URL or a server relative URL of the wiki page or in other words, the page URL whose manifest needs to be extracted.

So for example, if you want fetch the Page Manifest for a page on a top level site collection who’s URL is "http://contoso.com/pages/WikiPage.aspx" , below would be page URL the modal pop up would open;

http://contoso.com/_layouts/15/PageManifestExtractor/PageManifest.aspx?PageUrl=/pages/WikiPage.aspx

Similarly for extracting Page Manifest of a page from a Sharepoint sub-site with url as "http://contoso.com/mySite/Pages/WikiPage.aspx", below would be the page URL of the modal pop up;

http://contoso.com/mysite/_layouts/15/PageManifestExtractor/PageManifest.aspx?PageUrl=/mysite/pages/WikiPage.aspx.

NOTE: The page URL as mentioned in the PageUrl query string above can either be a server relative URL (as in the examples) or a Full Url as well such as below

http://contoso.com/_layouts/15/PageManifestExtractor/PageManifest.aspx?PageUrl=http://contoso.com/pages/WikiPage.aspx 

The modal popup as opened on the click of Ribbon Button display text in two tabs, i.e. Manifest and Content. By default Manifest tab is selected.

enter image description here

The Manifest tab gives element definition for the page i.e. using a Module tag to create the page using a Sharepoint Feature. This Module tag essentially consists of two pieces, one is the Page’s metadata, which is attributed to the page’s item in the Pages Library and other is All Webparts on the pages, with the details of the Webpart Zone, Zone Index and Webpart Properties. This element tag can now be copied and pasted in a feature element file and hence can be used to create this page in any other environment.

The other tab contains the content of the aspx file, which for most wiki pages is the same, mostly because they are ghosted pages. Typically on these pages it is the webparts which vary and information for these webparts are not imprinted on the actual aspx file for a particular page. They are instead fetched from the content database. But nonetheless the Feature Element required for provisioning this page would actually require an aspx file like a placeholder to be deployed to the pages library. For that aspx file, contents of this tab can be copied and pasted.

enter image description here

The All Manifests Button in the Library Tab of Pages Library opens a modal popup in exactly the same manner except for the URL it points to. In this case the url points to the same page as earlier however with a different query string parameter, i.e. in this case instead of PageUrl, the Parameter sent is ListId, which is the guid of list in context. So in essence if a page’s library has a GUID of “66769742-d599-448c-b5fc-3dbb18859141” the look of the url would be

http://contoso.com/mysite/_layouts/PageManifest/PageManifest.aspx?ListId={66769742-d599-448c-b5fc-3dbb18859141}

The resulting pop up fetches the Manifest XML in a similar manner, except for this time it fetches for all the pages in the library, including those in any folders in the library. The Manifest Tab, will give single Module node with multiple File node one for each page in the pages library. The Content tab will also give the Page Content for all the pages, which will be separated by a separator line, as highlighted in the screenshot below. enter image description here

Use Case

As mentioned earlier the control is mainly a developer level tool. This can mainly be used in scenarios where developer has finished developing a page, and need to package it, for deployment to any further environments.

On other hand this can also be used in scenarios where there might have been cases where changes have been made in some higher environments such as Production and need to be replicated in the lower environments. Now instead of redoing all the changes at a per change basis, the tool can be used to fetch page XML, package and then deploy it back on the lower environments.

Logging

The solution package implements logging at different levels depending on which artifact it is trying to fetch.

Webparts: At the lowest level the solution tries to fetch a list of all webparts on a page, and if there is any un-handled exception in doing that, the message is logged on the Manifest definition i.e. on the modal pop up itself. An example of such an exception occurring can be seen in the screenshot below;

enter image description here

Page Level: In scenarios where tool is trying to fetch Manifest information for multiple pages, if there happens to be an exception for one of the pages, it will be highlighted at the top of the modal pop up in red. All the other pages’ definition (where there is no exception) remains to be available on the modal pop and is usable. The message is a generic message and the actual exception logged can be viewed in the Sharepoint logs using the guid mentioned in the log message. enter image description here

Critical: This is the highest level of exception, where no proceed could be made by the tool. This is logged in red at the top of the modal pop up. The message is a generic message and the actual exception logged can be viewed in the Sharepoint logs using the guid mentioned in the log. enter image description here

One of the most common exceptions that occurs when using tool and has been found unavoidable, is the fact that webparts are set as un-exportable. That is each webpart has a security setting depending on which webparts information can be exported or is not allowed. This security setting can be seen in the screenshot below. So a recommendation to any developer using the tool to fetch a page’s information is to set the all the webparts setting exportable to be true. Else an exception is displayed in trying to fetch any webparts definition as in the image "Webpart Error" above. enter image description here

Please let me know if you have anything to ask.

4
  • where is the wsp file download link..?
    – TARUN
    Commented May 23, 2017 at 9:05
  • pagemanifestextractor.codeplex.com Commented May 23, 2017 at 9:07
  • It's still downloadable even if Codeplex is shutting down.
    – Benny Skogberg
    Commented May 23, 2017 at 9:59
  • it can be downloaded from many website I just given one reference. Commented May 23, 2017 at 11:32

Your Answer

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

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