Skip to Main Content
Essential SharePoint 2007, 2nd Edition
book

Essential SharePoint 2007, 2nd Edition

by Jeff Webb
September 2007
Beginner content levelBeginner
448 pages
10h 2m
English
O'Reilly Media, Inc.
Content preview from Essential SharePoint 2007, 2nd Edition

Exporting Web Parts

Users sometimes want to customize a web part and then reuse those changes on other pages. To do that from the browser, they make their changes, export the web part, and then import it on a new page.

To make a web part exportable, set the web part's ExportMode property as shown here:

// Constructor (hooks up event procedures)
public Properties4(  )
{
    // Allow non-sensitive properties to be exported.
    this.ExportMode = WebPartExportMode.NonSensitiveData;
}

The preceding code exports all properties not marked as sensitive in the Personalization attribute. Once the web part is marked as exportable, SharePoint adds an Export item to the web part's Edit menu, as shown in Figure 11-13.

Exporting a custom web part

Figure 11-13. Exporting a custom web part

Within the web part page, the properties are serialized, as shown here:

<WpNs0:Properties4 runat="server" ID="g_ca01d903_5f15_49b9_8553_3942dadb87d5"
ExportMode="NonSensitiveData" Title="Properties4 Web Part"
CalDate="04/25/2007 12:19:01" ImportErrorMessage="Cannot import
Properties4 Web Part." _ _MarkupType="vsattributemarkup" _
_WebPartId="{CA01D903-5F15-49B9-8553-3942DADB87D5}" WebPart="true"
_ _designer:IsClosed="false" partorder="2"></WpNs0:Properties4>

The ExportMode property sets the default mode used for the web part. You can override that setting by changing it in the web part tag above. The tag prefix used on the web part page is generated automatically. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Microsoft® Office SharePoint® Server 2007 Best Practices

Microsoft® Office SharePoint® Server 2007 Best Practices

Ben Curry, Bill English
SharePoint 2007: The Definitive Guide

SharePoint 2007: The Definitive Guide

James Pyles, Christopher M. Buechler, Bob Fox, Murray Gordon, Michael Lotter, Jason Medero, Nilesh Mehta, Joris Poelmans, Christopher Pragash, Piotr Prussak, Christopher J. Regan

Publisher Resources

ISBN: 9780596514075Errata Page