Share via


WebPartDefinition.DeleteWebPart method

Deletes the Web Part from the page.

Namespace:  Microsoft.SharePoint.Client.WebParts
Assembly:  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)

Syntax

'Declaration
Public Sub DeleteWebPart
'Usage
Dim instance As WebPartDefinition

instance.DeleteWebPart()
public void DeleteWebPart()

Exceptions

Exception Condition
[Microsoft.SharePoint.WebPartPages.WebPartPageUserException]

The current user has insufficient permissions. Error code: -1.

Remarks

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.

See also

Reference

WebPartDefinition class

WebPartDefinition members

Microsoft.SharePoint.Client.WebParts namespace