SP.WebParts.LimitedWebPartManager.importWebPart(webPartXml) Method

Applies to: SharePoint Foundation 2010

In this article
Return Value
Applies To

Imports a Web Part from a string in the .dwp format.

var value = SP.WebParts.LimitedWebPartManager.importWebPart(webPartXml);


  • webPartXml
    The Web Part markup to import.

Type: string

Return Value

Type: SP.WebParts.WebPartDefinition

Applies To

SP.WebParts.LimitedWebPartManager Class


After importing, the Web Part is not added to a Web Part Page. To add a Web Part to a Web Part Page, use addWebPart, supplying the object returned by this method.

When Scope is User, the current user must have permissions to add and delete personalized Web Parts. When Scope is Shared, the current user must have permissions to customize pages.

It must not be null. It must not be empty. It must be valid XML in the .dwp or .webpart format.

See Also


SP.WebParts.LimitedWebPartManager Methods

SP.WebParts.LimitedWebPartManager Properties

SP.WebParts Namespace