When web parts are deployed in a SharePoint Site Collection, they become available in the Web Part Gallery, so that they can be added to web part pages. The Web Part Gallery page shows the list of web parts installed in a Site Collection and each of the web part listed is represented by an xml file of .webpart extension that contains its definition. An example of a .webpart file is the following: <?xml version=”1.0″ encoding=”utf-8″?> <webParts> <webPart xmlns=”http://schemas.microsoft.com/WebPart/v3″> <metaData> <type name=”MyNamespace.SharePoint.WebParts.MyCustomWebPart, MyNamespace.SharePoint.WebParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5874548632a535ab” /> <importErrorMessage>Cannot import this Web Part.</importErrorMessage> </metaData> <data> <properties> <property name=”Title” type=”string”> MyCustomWebPart </property> </properties> </data> </webPart> </webParts> From the Web Part Gallery page, you can export (download) the web part definition into a file for later import or inclusion in a deployment package. You can also enable the Export option from web part itself when included in a web part page (this option is disabled by default). To do that, you must include the following lines of codes into the OnLoad event of your web part: protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (this.WebPartManager.DisplayMode != WebPartManager.BrowseDisplayMode) { this.ExportMode = WebPartExportMode.All; } } By adding this code, you will enable the web part to be exported when the page is being edited. An “Export…” option will be added to the web part edit context menu.

Related Articles

To learn why your business should migrate to SharePoint Online and Office 365, click here and here. If you want to convert your tenant’s root classic site into a modern SharePoint site, click here. If you are new to SharePoint and Office 365 and want to learn all about it, take a look at these learning resources. If you are work in a large organization who is using Office 365 or thinking to move to Office 365 and is considering between a single or multiple Office 365 tenants, I invite you to read this article. If you or your customers are not ready to move entirely to the Cloud and Office 365, a hybrid scenario could be an interesting scenario and SharePoint 2019 RTM was recently announced with improved hybrid support! To learn all about SharePoint 2019 and all its features, click here. If you are a SharePoint administrator or a SharePoint developer who wants to learn more about how to install a SharePoint 2019 farm in an automated way using PowerShell, I invite you to click here and here. If you want to learn how to upgrade a SharePoint 2013 farm to SharePoint 2019, click here and here. If you want to learn all the steps and precautions necessary to successfully keep your SharePoint farm updated and be ready to start your move to the cloud, click here. If you learn how to greatly speed up your SharePoint farm update process to ensure your SharePoint farm keeps updated and you stay one step closer to start your move to the cloud, click here. If SharePoint 2019 is still not an option, you can learn more about how to install a SharePoint 2016 farm in an automated way using PowerShell, click here and here. If you want to learn how to upgrade a SharePoint 2013 farm to SharePoint 2019, click here and here. If you want to know all about the latest SharePoint and Office 365 announcements from SharePoint Conference 2019, click here and here. Happy SharePointing!

LEAVE A REPLY

Please enter your comment!
Please enter your name here