Frage

In order to create a new web part page with a PowerShell script, you must provide a page layout. None of the page layouts on my site seem to match the Full Page, Vertical choice you have when you create a web part page with the UI under Choose a layout template. What page layout should I use to create a new web part page like the UI does?

War es hilfreich?

Lösung

You are looking for the values to provide for Layout template ($pageLayout)

$web = Get-SPWeb http://server/
$pagesLibrary = $web.GetList("Pages")
$pageLayout = 1
$cmd = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Method ID=\"0,NewWebPage\"><SetList Scope=\"Request\">" + $pagesLibrary.ID + "</SetList><SetVar Name=\"Cmd\">NewWebPage</SetVar><SetVar Name=\"ID\">New</SetVar><SetVar Name=\"Type\">WebPartPage</SetVar><SetVar Name=\"WebPartPageTemplate\">" + $pageLayout + "</SetVar><SetVar Name=\"Overwrite\">true</SetVar><SetVar Name=\"Title\">\"MyPage\"</SetVar></Method>"
$web.ProcessBatchData($cmd)

These are the various values you can use to set the layout templates ($pageLayout) as you need

1 - Full Page, Vertical

2 - Header, Footer, 3 Columns

3 - Header, Left Column, Body

4 - Header, Right Column, Body

5 - Header, Footer, 2 Columns, 4 Rows

6 - Header, Footer, 4 Columns, Top Row

7 - Left Column, Header, Footer, Top Row, 3 Columns

8 - Right Column, Header, Footer, Top Row, 3 Columns

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit sharepoint.stackexchange
scroll top