Skip to main content

spo page add

Creates modern page

Usage

m365 spo page add [options]

Options

-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, SingleWebPartAppPage, RepostPage, HeaderlessSearchResults, Spaces, Topic. Default Article.

-p, --promoteAs [promoteAs]

Create the page for a specific purpose. Allowed values HomePage, NewsPage, Template.

--commentsEnabled

Set to enable comments on the page.

--publish

Set to publish the page.

--publishMessage [publishMessage]

Message to set when publishing the page.

--description [description]

The description to set for the page.

-h, --help [help]

Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, response, full. Default is options.

--query [query]

JMESPath query string. See http://jmespath.org/ for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.

--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

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

Create new modern page and set its title

m365 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

m365 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

m365 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

m365 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

m365 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

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

Create new article page and publish it

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

Create new article page with description

m365 spo page add --name page.aspx --webUrl https://contoso.sharepoint.com/sites/a-team --description "Description to add for the page"

Response

The command won't return a response on success.

CTRL + M