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

# spo propertybag set

Sets the value of the specified property in the property bag. Adds the property if it does not exist

## Usage

```sh
m365 spo propertybag set [options]
```

## Options

```md definition-list
`-u, --webUrl <webUrl>`
: The URL of the site in which the property should be set

`-k, --key <key>`
: Key of the property to be set. Case-sensitive

`-v, --value <value>`
: Value of the property to be set

`--folder [folder]`
: Site-relative URL of the folder on which the property should be set
```

<Global />

## Remarks

If a site has NoScript enabled, setting property bag values may result in an _Access is denied_ error. To resolve this, you can configure a tenant-wide property to allow property bag updates on NoScript sites.

## Examples

Sets the value of the property in the property bag of the given site

```sh
m365 spo propertybag set --webUrl https://contoso.sharepoint.com/sites/test --key key1 --value value1
```

Sets the value of the property in the property bag of the root folder of the given site

```sh
m365 spo propertybag set --webUrl https://contoso.sharepoint.com/sites/test --key key1 --value value1 --folder /
```

Sets the value of the property in the property bag of a document library located in the given site

```sh
m365 spo propertybag set --webUrl https://contoso.sharepoint.com/sites/test --key key1 --value value1 --folder '/Shared Documents'
```

Sets the value of the property in the property bag of a folder in a document library located in the given site

```sh
m365 spo propertybag set --webUrl https://contoso.sharepoint.com/sites/test --key key1 --value value1 --folder '/Shared Documents/MyFolder'
```

Sets the value of the property in the property bag of a list in the given site

```sh
m365 spo propertybag set --webUrl https://contoso.sharepoint.com/sites/test --key key1 --value value1 --folder /Lists/MyList
```

## Response

The command won't return a response on success.
