This topic has not yet been rated - Rate this topic

SPWebPartManager.ImportWebPart Method

Imports an XML description file that contains state and property data for a Web Part, applies the data to the Web Part, and registers the Web Part with the SPWebPartManager.

Namespace:  Microsoft.SharePoint.WebPartPages
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
public override WebPart ImportWebPart(
	XmlReader reader,
	out string errorMessage
)

Parameters

reader
Type: System.Xml.XmlReader
An XmlReader that reads the state and property data from the XML description file that is being imported.
errorMessage
Type: System.String%
A string that is displayed to the user if an error is encountered during import.

Return Value

Type: System.Web.UI.WebControls.WebParts.WebPart
The imported Web Part that is referenced in the XML description file.
Exception Condition
ArgumentNullException

reader is null.

This override does not import the actual Web Part control. The XML description file contains only state and property data about the Web Part. The control and assembly referenced in the description file must already be available on the server.

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ