Return Type: Microsoft.SharePoint.Client.WebParts.WebPartDefinition

Imports a Web Part from a string in the .dwp format as specified in [MS-WPPS] section, or the .webpart format as specified in [MS-WPPS] section 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 (1) returned by this method. A reference to the added SP.WebParts.WebPartDefinition is returned.

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.


webPartXml: The Web Part markup to import.

Type: CSOM String

It MUST NOT be NULL. It MUST NOT be empty. It MUST be valid XML in the .dwp or .webpart format.


Error Code

Error Type Name




The provided Web Part markup is not in the .dwp or .webpart format.