Skip to content

spo page add

Creates modern page

Usage

spo page add [options]

Options

Option Description
--help output usage information
-n, --name <name> Name of the page to create
-u, --webUrl <webUrl> URL of the site where the page should be created
-t, --title [title] Title of the page to create. If not specified, will use the page name as its title
-l, --layoutType [layoutType] Layout of the page. Allowed values Article|Home. Default Article
-p, --promoteAs [promoteAs] Create the page for a specific purpose. Allowed values HomePage|NewsPage
--commentsEnabled Set to enable comments on the page
--publish Set to publish the page
--publishMessage [publishMessage] Message to set when publishing the page
-o, --output [output] Output type. json|text. Default text
--verbose Runs command with verbose logging
--debug Runs command with debug logging

Remarks

If you try to create a page with a name of a page that already exists, you will get a The file exists error.

If you choose to promote the page using the promoteAs option or enable page comments, you will see the result only after publishing the page.

Examples

Create new modern page. Use the Article layout

spo page add --name new-page.aspx --webUrl https://contoso.sharepoint.com/sites/a-team

Create new modern page and set its title

spo page add --name new-page.aspx --title 'My page' --webUrl https://contoso.sharepoint.com/sites/a-team

Create new modern page. Use the Home page layout and include the default set of web parts

spo page add --name new-page.aspx --webUrl https://contoso.sharepoint.com/sites/a-team --layoutType Home

Create new article page and promote it as a news article

spo page add --name new-page.aspx --webUrl https://contoso.sharepoint.com/sites/a-team --promoteAs NewsPage

Create new page and set it as the site's home page

spo page add --name new-page.aspx --webUrl https://contoso.sharepoint.com/sites/a-team --layoutType Home --promoteAs HomePage

Create new article page and promote it as a template

spo page add --name page.aspx --webUrl https://contoso.sharepoint.com/sites/a-team --promoteAs Template

Create new article page and enable comments on the page

spo page add --name new-page.aspx --webUrl https://contoso.sharepoint.com/sites/a-team --commentsEnabled

Create new article page and publish it

spo page add --name new-page.aspx --webUrl https://contoso.sharepoint.com/sites/a-team --publish