Skip to content

spo page set

Updates modern page properties

Usage

spo page set [options]

Options

Option Description
--help output usage information
-n, --name <name> Name of the page to update
-u, --webUrl <webUrl> URL of the site where the page to update is located
-l, --layoutType [layoutType] Layout of the page. Allowed values Article|Home
-p, --promoteAs [promoteAs] Update the page purpose. Allowed values HomePage|NewsPage
--commentsEnabled [commentsEnabled] Set to true, to enable comments on the page. Allowed values true|false
--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

Important

Before using this command, log in to a SharePoint Online site, using the spo login command.

Remarks

To update a modern page, you have to first log in to a SharePoint site using the spo login command, eg. spo login https://contoso.sharepoint.com.

If you try to create a page with a name of a page that already exists, you will get a The file doesn't 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

Change the layout of the existing page to Article

spo page set --name page.aspx --webUrl https://contoso.sharepoint.com/sites/a-team --layoutType Article

Promote the existing article page as a news article

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

Change the page's layout to Home and set it as the site's home page

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

Enable comments on the existing page

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

Publish existing page

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