import Global from '../../_global.mdx';

# spo page section add

Adds section to modern page

## Usage

```sh
m365 spo page section add [options]
```

## Options

```md definition-list
`-n, --pageName <pageName>`
: Name of the page to add section to.

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

`-t, --sectionTemplate <sectionTemplate>`
: Type of section to add. Allowed values `OneColumn`, `OneColumnFullWidth`, `TwoColumn`, `ThreeColumn`, `TwoColumnLeft`, `TwoColumnRight`, `Vertical`, `Flexible`.

`--order [order]`
: Order of the section to add.

`--zoneEmphasis [zoneEmphasis]`
: Section background shading. Allowed values `None`, `Neutral`, `Soft`, `Strong`, `Image`,`Gradient`

`--isLayoutReflowOnTop`
: The position of the Vertical section for smaller screens. Applied only for `Vertical` section.

`--isCollapsibleSection`
: Set section to be collapsible.

`--showDivider`
: Shows a divider line between sections.

`--iconAlignment [iconAlignment]`
: Specifies the alignment of the expand/collapse icon. Sets `Left` alignment if not specified.

`--isExpanded`
: Sets the default display state of the collapsible section. Sets `false` if not specified.

`--headingLevel [headingLevel]`	
: Heading level of collapsible section Allowed values `2`, `3`, `4`.

`--gradientText [gradientText]`
: Sets the gradient setting of the background of a section. Required when `zoneEmphasis` is `Gradient`.

`--imageUrl [imageUrl]`
: The background image URL. Required when `zoneEmphasis` is `Image`.

`--imageHeight [imageHeight]`
: The height of the background image. Applied only when when `zoneEmphasis` is `Image`. Sets `955` value if not specified.

`--imageWidth [imageWidth]`
: The width of the background image. Applied only when `zoneEmphasis` is `Image`. Sets `555` value if not specified.

`--fillMode [fillMode]`
: The fill mode of the background image. Applied only when `zoneEmphasis` is `Image`. Possible values are `ScaleToFill`, `ScaleToFit`, `Tile`, `OriginalSize`. Sets `ScaleToFill` value if not specified.

`--useLightText`
: Specifies whether to use light text for the background. Applied only when `zoneEmphasis` is `Image`.

`--overlayColor [overlayColor]`
:	The overlay color for the background in #RRGGBB format. Applied only when `zoneEmphasis` is `Image` or `Gradient`. Sets `#ffffff` value if not specified.

`--overlayOpacity [overlayOpacity]`	
: The overlay opacity for the background. Applied only when `zoneEmphasis` is `Image` or `Gradient`. Sets `60` value if not specified.

`--collapsibleTitle [collapsibleTitle]`	
: The display name of the collapsible section.

`--zoneReflowStrategy [zoneReflowStrategy]`	
: Mobile and email reflow. Allowed values `TopToBottom`, `LeftToRight`. Applied only for `Flexible` section.

`--zoneHeight [zoneHeight]`	
: Section height. Minimum value is `34`. Applied only for `Flexible` section.
```

<Global />

## Remarks

If the specified `pageName` doesn't refer to an existing modern page, you will get a _File doesn't exists_ error.

## Examples

Add section to the modern page

```sh
m365 spo page section add --pageName home.aspx --webUrl https://contoso.sharepoint.com/sites/newsletter --sectionTemplate OneColumn --order 1
```

Add section with background shading to the modern page

```sh
m365 spo page section add --pageName home.aspx --webUrl https://contoso.sharepoint.com/sites/newsletter --sectionTemplate OneColumn --zoneEmphasis Strong 
```

Add a vertical section to the modern page. There can only be one vertical section per page. If a vertical section already exists on the page, the command will not have any effect.

```sh
m365 spo page section add --pageName home.aspx --webUrl https://contoso.sharepoint.com/sites/newsletter --sectionTemplate Vertical
```

Add Vertical section with background shading to the modern page with adjusting the position of this section for smaller screens to the top

```sh
m365 spo page section add --pageName home.aspx --webUrl https://contoso.sharepoint.com/sites/newsletter --sectionTemplate Vertical --zoneEmphasis Neutral --isLayoutReflowOnTop
```

Add One Column section as a collapsible section with title

```sh
m365 spo page section add --pageName home.aspx --webUrl https://contoso.sharepoint.com/sites/newsletter --sectionTemplate OneColumn --isCollapsibleSection --collapsibleTitle "Collapsible Section Title"
```

Add OneColumn section as a collapsible section as expanded with icon aligned to the left

```sh
m365 spo page section add --pageName home.aspx --webUrl https://contoso.sharepoint.com/sites/newsletter --sectionTemplate OneColumn --isCollapsibleSection --isExpanded --iconAlignment Left
```

Add OneColumn section as a collapsible section as expanded with headingLevel 3

```sh
m365 spo page section add --pageName home.aspx --webUrl https://contoso.sharepoint.com/sites/newsletter --sectionTemplate OneColumn --isCollapsibleSection --isExpanded --headingLevel 3
```

Add TwoColumn section with Image background

```sh
m365 spo page section add --pageName home.aspx --webUrl https://contoso.sharepoint.com/sites/newsletter --sectionTemplate TwoColumn --imageUrl "https://contoso.com/image.jpg" --zoneEmphasis Image --fillMode Tile
```

Add OneColumn section with Gradient background

```sh
m365 spo page section add --pageName home.aspx --webUrl https://contoso.sharepoint.com/sites/newsletter --sectionTemplate TwoColumn --zoneEmphasis Gradient --gradientText "linear-gradient(72.44deg, #E6FBFE 0%, #EDDDFB 100%)"
```

Add a Flexible section to the modern page with mobile and email reflow and section height.

```sh
m365 spo page section add --pageName home.aspx --webUrl https://contoso.sharepoint.com/sites/newsletter --sectionTemplate Flexible --zoneHeight 100 --zoneReflowStrategy LeftToRight
```

## Response

The command won't return a response on success.
