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

# spo file version keep

Ensure that a specific file version will never expire

## Usage

```sh
m365 spo file version keep [options]
```

## Options

```md definition-list
`-u, --webUrl <webUrl>`
: The URL of the site where the file is located.

`--fileUrl [fileUrl]`
: The server- or site-relative decoded URL. Specify either `fileUrl` or `fileId` but not both.

`-i, --fileId [fileId]`
: The UniqueId (GUID) of the file. Specify either `fileUrl` or `fileId` but not both.

`--label <label>`
: Label of the version.
```

<Global />

## Permissions

<Tabs>
  <TabItem value="Delegated">

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

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

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

  </TabItem>
</Tabs>

## Examples

Mark a file version as never expiring by file URL.

```sh
m365 spo file version keep --webUrl "https://contoso.sharepoint.com/sites/marketing" --fileUrl "/sites/marketing/Documents/report.docx" --label "6.0"
```

Mark a file version as never expiring by file ID.

```sh
m365 spo file version keep --webUrl "https://contoso.sharepoint.com/sites/marketing" --fileId "12345678-90ab-cdef-1234-567890abcdef" --label "6.0"
```

## Response

The command won't return a response on success.
