import Global from '../../_global.mdx';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# spo page header set

Sets modern page header

## Usage

```sh
m365 spo page header set [options]
```

## Options

```md definition-list
`-n, --pageName <pageName>`
: Name of the page to set the header for.

`-u, --webUrl <webUrl>`
: URL of the site where the page to update is located.

`-t, --type [type]`
: Type of header, allowed values `None`, `Default`, `Custom`. Default `Default`.

`--imageUrl [imageUrl]`
: Server-relative URL of the image to use in the header. Image must be stored in the same site collection as the page.

`--altText [altText]`
: Header image alt text.

`-x, --translateX [translateX]`
: X focal point of the header image.

`-y, --translateY [translateY]`
: Y focal point of the header image.

`--layout [layout]`
: Layout to use in the header. Allowed values `FullWidthImage`, `NoImage`, `ColorBlock`, `CutInShape`. Default `FullWidthImage`.

`--textAlignment [textAlignment]`
: How to align text in the header. Allowed values `Center`, `Left`. Default `Left`.

`--showTopicHeader [showTopicHeader]`
: Show the topic header. Valid values: `true`, `false`. Defaults to `false`.

`--showPublishDate [showPublishDate]`
: Show the publishing date. Valid values: `true`, `false`. Defaults to `false`.

`--showTimeToRead [showTimeToRead]`
: Show the estimated time to read the page. Valid values: `true`, `false`. Defaults to `false`.

`--topicHeader [topicHeader]`
: Text to show in the topic header, when `showTopicHeader` is set.

`--authors [authors]`
: Comma-separated list of page authors to show in the header.
```

<Global />

## Permissions

<Tabs>
  <TabItem value="Delegated">

  | Resource   | Permissions    |
  |------------|----------------|
  | SharePoint | AllSites.Write |

  </TabItem>
  <TabItem value="Application">

  | Resource   | Permissions         |
  |------------|---------------------|
  | SharePoint | Sites.ReadWrite.All |

  </TabItem>
</Tabs>

## Examples

Reset the page header to default

```sh
m365 spo page header set --webUrl https://contoso.sharepoint.com/sites/team-a --pageName home.aspx
```

Reset the page header to default and set authors

```sh
m365 spo page header set --webUrl https://contoso.sharepoint.com/sites/team-a --pageName home.aspx --authors "steve@contoso.com, bob@contoso.com"
```

Use the specified image focused on the given coordinates in the page header

```sh
m365 spo page header set --webUrl https://contoso.sharepoint.com/sites/team-a --pageName home.aspx --type Custom --imageUrl /sites/team-a/SiteAssets/hero.jpg --altText 'Sunset over the ocean' --translateX 42.3837520042758 --translateY 56.4285714285714
```

Center the page title in the header and show the publishing date and time to read

```sh
m365 spo page header set --webUrl https://contoso.sharepoint.com/sites/team-a --pageName home.aspx --textAlignment Center --showPublishDate true --showTimeToRead true
```

## Response

The command won't return a response on success.
