Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .devproxy/api-specs/sharepoint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,35 @@ paths:
responses:
200:
description: OK
/_api/Lists(guid'{listId}')/items({itemId})/UnArchive:
post:
parameters:
- name: listId
in: path
required: true
description: list GUID
schema:
type: string
example: b2307a39-e878-458b-bc90-03bc578531d6
- name: itemId
in: path
required: true
description: list item ID
schema:
type: integer
example: 1
security:
- delegated:
- AllSites.Write
- AllSites.Manage
- AllSites.FullControl
- application:
- Sites.ReadWrite.All
- Sites.Manage.All
- Sites.FullControl.All
responses:
200:
description: OK
/_api/contextinfo:
post:
security:
Expand Down Expand Up @@ -217,6 +246,30 @@ paths:
responses:
200:
description: OK
/_api/web/GetFileById({fileId}):
get:
parameters:
- name: fileId
in: path
required: true
description: file unique ID
schema:
type: string
example: "'7a8c9207-7745-4cda-b0e2-be2618ee3030'"
security:
- delegated:
- AllSites.Read
- AllSites.Write
- AllSites.Manage
- AllSites.FullControl
- application:
- Sites.Read.All
- Sites.ReadWrite.All
- Sites.Manage.All
- Sites.FullControl.All
responses:
200:
description: OK
/_api/web/GetFileById({fileId})/versions:
get:
parameters:
Expand Down
106 changes: 106 additions & 0 deletions docs/docs/cmd/spo/file/file-unarchive.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import Global from '../../_global.mdx';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# spo file unarchive

Unarchives a file

## Usage

```sh
m365 spo file unarchive [options]
```

## Options

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

`--url [url]`
: The server- or site-relative decoded URL of the file to unarchive. Specify either `url` or `id`, but not both.

`-i, --id [id]`
: The UniqueId (GUID) of the file to unarchive. Specify either `url` or `id`, but not both.

`-f, --force`
: Don't prompt for confirmation.
```

<Global />

## Permissions

<Tabs>
<TabItem value="Delegated">

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

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

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

</TabItem>
</Tabs>

## Examples

Unarchive a file by id without prompting for confirmation

```sh
m365 spo file unarchive --webUrl https://contoso.sharepoint.com/sites/Marketing --id 7a8c9207-7745-4cda-b0e2-be2618ee3030 --force
```

Unarchive a file by URL with prompting for confirmation

```sh
m365 spo file unarchive --webUrl https://contoso.sharepoint.com/sites/Marketing --url '/sites/Marketing/shared documents/document.docx'
```

## Response

<Tabs>
<TabItem value="JSON">

```json
{
"value": "reactivating"
}
```

</TabItem>
<TabItem value="Text">

```text
value: reactivating
```

</TabItem>
<TabItem value="CSV">

```csv
value
reactivating
```

</TabItem>
<TabItem value="Markdown">

```md
# spo file unarchive --debug "false" --verbose "false" --webUrl "https://contoso.sharepoint.com/sites/Marketing" --url "/sites/Marketing/shared documents/General/document.docx" --force "true"

Date: 5/8/2026

Property | Value
---------|-------
value | reactivating
```

</TabItem>
</Tabs>
5 changes: 5 additions & 0 deletions docs/src/config/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2756,6 +2756,11 @@ const sidebars: SidebarsConfig = {
label: 'file rename',
id: 'cmd/spo/file/file-rename'
},
{
type: 'doc',
label: 'file unarchive',
id: 'cmd/spo/file/file-unarchive'
},
{
type: 'doc',
label: 'file retentionlabel ensure',
Expand Down
1 change: 1 addition & 0 deletions src/m365/spo/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export default {
FILE_SHARINGLINK_LIST: `${prefix} file sharinglink list`,
FILE_SHARINGLINK_REMOVE: `${prefix} file sharinglink remove`,
FILE_SHARINGLINK_SET: `${prefix} file sharinglink set`,
FILE_UNARCHIVE: `${prefix} file unarchive`,
FILE_VERSION_CLEAR: `${prefix} file version clear`,
FILE_VERSION_GET: `${prefix} file version get`,
FILE_VERSION_KEEP: `${prefix} file version keep`,
Expand Down
Loading
Loading