Export any web part from a SharePoint page
By Anatoly Mironov
The blog post below describes the technical details about how Web Parts can be exported using a hidden tool in OOB SharePoint, though this requires manual assembling of a special url. If you are just interested in a solution for an easy Web Part Export function, just proceed directly to my new blog post where you can download my tool that you can add to your web browser.
[youtube https://www.youtube.com/watch?v=wL9y9E1aJy0]
Technical background
Almost all web parts can be exported from a SharePoint page. An exported web part can be imported on another page or it can be used as a source in a module to provision pages. An exception is the XsltListViewWebPart, there you cannot enable exporting. I have used Glyn Clough’s method before which has worked although it is a complicated process. Now I have found another way for exporting any web part (even ListViewWebPart and XsltListViewWebPart) present on a page. A method that only involves a web browser.
How to export any web part
First, we need to find out the webpartid. To do so inspect the html markup with the web browser dev tools of your choice. In SharePoint there is a hidden application page that exports web parts: /_vti_bin/exportwp.aspx. This page takes two query parameters:
- pageurl. The absolute url of the page where the web part resides that you want to export
- guidstring. The guid that is called webpartid in the markup on the page
So, suppose, you have this site: https://intranet.contoso.com and a web part (id: 0c3adfe9-8f5d-4432-918a-42410e4e324d) on a page https://intranet.contoso.com**/Pages/default.aspx** This will be the resulting URL to export your webpart: https://intranet.contoso.com/_vti_bin/exportwp.aspx?pageurl=https://intranet.contoso.com/Pages/default.aspx&guidstring=0c3adfe9-8f5d-4432-918a-42410e4e324d Paste it into the web browser address bar and you’ll download an xml file with your web part definition. This method works in SharePoint 2010 and SharePoint 2013 and even in SharePoint Online (Office 365).
Sources
Natalia Tsymbalenko. Get the list view web part convertable Maurice Prather. Exporting a ListViewWebPart
SharePoint StackExchange
I am glad to update my answer on SharePoint StackExchange site and provide a much easier way of exporting any web part from SharePoint.
Bookmarklet (update 2015-10-21)
Finally there is a bookmarklet for making Web Part Export a lot easier. See my new blog post for more details:
Comments from Wordpress.com
JimH - Mar 5, 2015
Works like a charm, Thanks! We’re about to migrate to 2013, so I’m looking foward to testing this in 2013, given the changes to SPD.
Awesome, trick!! It helped a lot to me! Thanks!!!
Hi, Thanks for this - having a problem adding the list view part to a page on the root of the site - the list is located within a subsite - getting the following error message: “List does not exist The page you selected contains a list that does not exist” However, can add the imported webpart OK to a page on the subsite that contains the list - will this only work if adding the webpart to a page on the same site/subsite as the list? Thanks in advance
Thank you!
This is brilliant! Thanks for sharing this!
Hi, I am trying to export a webpart from my site - but it’s not working. I get “error something went wrong”. Could you maybe take a look at my url and see if it’s correct? I am using SP Online. https://wwdemo11.sharepoint.com/teams/HR-hejaheja2//_vti_bin/exportwp.aspx?pageurl= https://wwdemo11.sharepoint.com/teams/HR-hejaheja2/_layouts/15/start.aspx&guidstring= ebf04c7a-600b-4a16-bf28-a104372bef56 Where https://wwdemo11.sharepoint.com/teams/HR-hejaheja2/_layouts/15/start.aspx#/ is where my webparts is. I’m not sure if I miss some part of the url or not? Thanks, Amanda - SharePoint rookie
Hi Amanda, the “pageurl” parameter is wrong. It points to the start.aspx which is an application page that is used for MDS. You should the real page url. You can see after the “#”. if it is too confusing, you could temporarily deactivate the MDS (Minimal Download Strategy) feature on the current web.
Cool, thank your for your tip. That’s actually nice.I’ll update my post with this tip.
[…] blog post about exporting any webpart from a SharePoint Page is one of the most read articles on my blog. I use this method a lot. Now what I want to do is to […]
If you have a modern browser with developer tools IE, Chrome etc, you can just edit the html in place in the webpart and change allowexport to true [allowexport=“true”] while in editmode and it will then be able to be exported as usual from the webpart dropdown menu.
[…] this link which allows for a direct export of any visible web part. This uses a trick I found on CHUVASH.eu which highlights that there’s a special ‘exportwp.aspx’ page within SharePoint […]
Thanks for the feedback! Are you going to migrate webparts to the new environment using this method?
Hi, when i add to other site under same site collection, it is not working (List does not exists! error). How to fix this
Hi, when i added to another site (same site collection) - this is not working (list does not exists! error) - is there a fix for that?
Hello
Hello. Thanks for article. How I can create HttpRequest to _vti_bin/exportwp.aspx from provider hosted app or how I can get credentials from client context of provider hosted app?
Cool you liked.
Nice! Any way to export the audience targeting info as well?
Dude, this is just the thing I was looking for, great post!
Hi, The Target Audience is not a part of an “exportable” webpart definition. The Target Audience is saved on a particular webpart instance on a particular page.
Make sure your site url and page url are of the same site, not site collection so if its a subsite that you want to export from, make the first part of the url the same. ex. instead of https://intranet.contoso.com/_vti_bin/exportwp.aspx?pageurl=https://intranet.contoso.com/sites/Architect/150505.00-101w79-Gilbert/Sit it should be: https://intranet.contoso.com/sites/Architect/150505.00-101w79-Gilbert/_vti_bin/exportwp.aspx?pageurl=https://intranet.contoso.com/sites/Architect/150505.00-101w79-Gilbert/SitePages/Home.aspx&guidstring=4d1690b3-5235-4d05-88e9-36c70167geh
I encounter the same error like binu: List doesn’t exist. I’ve downloaded the file with your bookmarklet. But maybe I used the bookmarklet on the wrong site, to get the webpart? Thanks in advance!
Me, too! Help:)! List does not exist! Any ideas? Getting the same thing when use SPD and Export to Site Gallery, even when telling it to retain absolute not relative path to list/site.
[…] Since I knew, that the CreateWebPartFromList method of the Microsoft.SharePoint.WebPartPages.SPWebPartManager is not accessible via the client object model, I first planned to apply the another approach: export the source web part via a LimitedWebPartManager instance (the client-side equivalent of SPLimitedWebPartManager), then use another LimitedWebPartManager instance to import it onto the target page. BUT (there is almost always a but…) it turned out, that although LimitedWebPartManager supports the ImportWebPart method, the ExportWebPart method is not available on the client-side (Note: as Waldek Mastykarz reported, the ExportWebPart method should be available since the March 2016 SharePoint Online CSOM update). So I came up with a fall-back plan and exported the web part by calling the exportwp.aspx page as described here by Anatoly Mironov. […]
The id of the site where the list has been created ^^
You need to edit the .webpart with notepad and edit the WebId parameter, you will see is set as “00000000-0000-0000-0000-000000000000” To get the Id, use powershell Get-SPSite http://| Get-SPWeb -Limit All | Select Title, ID > C:\ListId.txt
Awesome, great!