Share via


DeleteWebPart Method

The DeleteWebPart method of the Web Part Pages service deletes a dynamic Web Part from a Web Part Page.

Parameters

Remarks

The DeleteWebPart method is used to delete a Web Part. Deleting a Shared Web Part, when storage is set to Personal, will throw the exception "Cannot delete Shared Web Part".

Example

The following code example shows a locally defined DeleteWebPart method that takes a GUID of a Web Part as an argument and deletes the Web Part from a Web Part Page by calling the DeleteWebPart method of the Web Part Pages service through a proxy. This code example and the proxy are part of a larger example provided for the Web Part Pages service.

Requirements

Platforms: Microsoft Windows Server 2003

Web Reference: http://Server_Name[sites/][Site_Name/]/_vti_bin/WebPartPages.asmx

Security: Code Access Security