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.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
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.WebPartThe imported Web Part that is referenced in the XML description file.
| Exception | Condition |
|---|---|
| ArgumentNullException |
reader is null. |