SP.WebParts.LimitedWebPartManager.addWebPart(webPart, zoneId, zoneIndex) Method

Applies to: SharePoint Foundation 2010

In this article
Return Value
Applies To
Remarks

Adds a Web Part to the Web Part Page.

var value = SP.WebParts.LimitedWebPartManager.addWebPart(webPart, zoneId, zoneIndex);

Parameters

  • webPart
    The Web Part to add to the Web Part Page.

Type: SP.WebParts.WebPart

  • zoneId
    The name of the Web Part zone to which to add the Web Part.

Type: string

  • zoneIndex
    A Web Part zone index that specifies the position at which the Web Part will be inserted within the Web Part zone.

Type: int

Return Value

Type: SP.WebParts.WebPartDefinition

Applies To

SP.WebParts.LimitedWebPartManager Class

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. Use importWebPart to import a Web Part, and then use addWebPart to add it to the Web Part Page. Each Web Part zone must have a unique name. It must not be null. It must not be empty. Its length must be equal to or less than 64.

The new Web Part must be inserted directly before the existing Web Part with the lowest Web Part zone index greater than or equal to zoneIndex. If zoneIndex is greater than the index of all Web Parts in the zone or there are no Web Parts in the Web Part zone, then the new Web Part must be inserted at the end of the Web Part zone. Its value must be equal to or greater than 0.

See Also

Reference

SP.WebParts.LimitedWebPartManager Methods

SP.WebParts.LimitedWebPartManager Properties

SP.WebParts Namespace