Table of contents
TOC
Collapse the table of content
Expand the table of content

Add-PnPWebPartToWebPartPage

Bert Jansen|Last Updated: 2/20/2017
|
1 Contributor

Adds a webpart to a web part page in a specified zone

Syntax

Add-PnPWebPartToWebPartPage -Xml <String>
                            -ServerRelativePageUrl <String>
                            -ZoneId <String>
                            -ZoneIndex <Int>
                            [-Web <WebPipeBind>]
Add-PnPWebPartToWebPartPage -Path <String>
                            -ServerRelativePageUrl <String>
                            -ZoneId <String>
                            -ZoneIndex <Int>
                            [-Web <WebPipeBind>]

Parameters

ParameterTypeRequiredDescription
PathStringTrueA path to a webpart file on a the file system.
ServerRelativePageUrlStringTrueServer Relative Url of the page to add the webpart to.
XmlStringTrueA string containing the XML for the webpart.
ZoneIdStringTrue
ZoneIndexIntTrue
WebWebPipeBindFalseThe web to apply the command to. Omit this parameter to use the current web.

Examples

Example 1

PS:> Add-PnPWebPartToWebPartPage -ServerRelativePageUrl "/sites/demo/sitepages/home.aspx" -Path "c:\myfiles\listview.webpart" -ZoneId "Header" -ZoneIndex 1

This will add the webpart as defined by the XML in the listview.webpart file to the specified page in the specified zone and with the order index of 1

Example 2

PS:> Add-PnPWebPartToWebPartPage -ServerRelativePageUrl "/sites/demo/sitepages/home.aspx" -XML $webpart -ZoneId "Header" -ZoneIndex 1

This will add the webpart as defined by the XML in the $webpart variable to the specified page in the specified zone and with the order index of 1

© 2017 Microsoft