Compartilhar via


Export a Sharepoint List view web part

SharePoint List view web part, one of the most used Out of the box web part in any SharePoint application. Often we need to deal with this web part and some time we may need to export this as well. And here we face some issue when we need to export a list view webpart.

By default the list view webpart doesn't come with the Export mode on,nor even there is an option to switch it on from edit panel. In my project almost 2 hour I was just struggling and tried all the means that I found on Google or Bing. Few blogs suggest Share point designer, few blog suggest some JS to be run on browser etc etc.

But NO FRUITFUL RESULT and I landed up with some utter frustration. Little more searching on web part definition and internal xml structure I landed up with this quick trick.

Steps

1.Open notepad and copy paste the following xml

 <webParts>
 <webPart xmlns="https://schemas.microsoft.com/WebPart/v3">
 <metaData>
<type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name="ListUrl" type="string">/Lists/DemoList/AllItems.aspx</property>
<property name="ExportMode" type="exportmode">All</property>
 <property name="ID" type="string">wp1</property>
 </properties>
</data>
</webPart>
</webParts>
 2.Save the file with .webpart extension
 3.Navigate to the page where I want to add the list view web part.
 4.Edit the page and click on Add web part
 5.In web part add pane click on the upload web part.
 6.Upload the saved file it will appear under the Imported web part list.
 7.Now add the imported web part to your page.Do all the require settings.
 8.Export the page.
 Bingo the exported page contains the configured web part. My problem solved and all my struggle to export a page with preconfigured web part comes to an end.