WebPartDefinition.DeleteWebPart Method

Deletes the Web Part from the page.

Namespace:  Microsoft.SharePoint.Client.WebParts
Assemblies:   Microsoft.SharePoint.Client.Silverlight (in Microsoft.SharePoint.Client.Silverlight.dll);  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)

Syntax

'Declaration
<RemoteAttribute> _
Public Sub DeleteWebPart
'Usage
Dim instance As WebPartDefinition

instance.DeleteWebPart()
[RemoteAttribute]
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