Skip to content

Commit 7a6a098

Browse files
committed
New command: spo file unarchive. Closes #7176
1 parent 293104a commit 7a6a098

6 files changed

Lines changed: 568 additions & 0 deletions

File tree

.devproxy/api-specs/sharepoint.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,35 @@ paths:
7373
responses:
7474
200:
7575
description: OK
76+
/_api/Lists(guid'{listId}')/items({itemId})/UnArchive:
77+
post:
78+
parameters:
79+
- name: listId
80+
in: path
81+
required: true
82+
description: list GUID
83+
schema:
84+
type: string
85+
example: "'b2307a39-e878-458b-bc90-03bc578531d6'"
86+
- name: itemId
87+
in: path
88+
required: true
89+
description: list item ID
90+
schema:
91+
type: integer
92+
example: 1
93+
security:
94+
- delegated:
95+
- AllSites.Write
96+
- AllSites.Manage
97+
- AllSites.FullControl
98+
- application:
99+
- Sites.ReadWrite.All
100+
- Sites.Manage.All
101+
- Sites.FullControl.All
102+
responses:
103+
200:
104+
description: OK
76105
/_api/contextinfo:
77106
post:
78107
security:
@@ -238,6 +267,44 @@ paths:
238267
responses:
239268
200:
240269
description: OK
270+
/_api/web/GetFileByServerRelativePath(DecodedUrl={filePath}):
271+
get:
272+
parameters:
273+
- name: filePath
274+
in: path
275+
required: true
276+
description: URL-encoded server-relative path to the file
277+
schema:
278+
type: string
279+
example: "'%2Fsites%2FM365SOBA%2Fshared%20documents%2Fgeneral%2Fdocument.docx'"
280+
- name: $select
281+
in: query
282+
required: false
283+
description: Comma-separated list of properties to return
284+
schema:
285+
type: string
286+
example: "ListId"
287+
- name: $expand
288+
in: query
289+
required: false
290+
description: Comma-separated list of navigation properties to expand
291+
schema:
292+
type: string
293+
example: "ListItemAllFields"
294+
security:
295+
- delegated:
296+
- AllSites.Read
297+
- AllSites.Write
298+
- AllSites.Manage
299+
- AllSites.FullControl
300+
- application:
301+
- Sites.Read.All
302+
- Sites.ReadWrite.All
303+
- Sites.Manage.All
304+
- Sites.FullControl.All
305+
responses:
306+
200:
307+
description: OK
241308
/_api/web/GetFileByServerRelativePath(DecodedUrl={filePath})/$value:
242309
get:
243310
parameters:
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import Global from '../../_global.mdx';
2+
import Tabs from '@theme/Tabs';
3+
import TabItem from '@theme/TabItem';
4+
5+
# spo file unarchive
6+
7+
Unarchives a file
8+
9+
## Usage
10+
11+
```sh
12+
m365 spo file unarchive [options]
13+
```
14+
15+
## Options
16+
17+
```md definition-list
18+
`-u, --webUrl <webUrl>`
19+
: The URL of the site where the file is located.
20+
21+
`--url [url]`
22+
: The server- or site-relative decoded URL of the file to unarchive. Specify either `url` or `id`, but not both.
23+
24+
`-i, --id [id]`
25+
: The UniqueId (GUID) of the file to unarchive. Specify either `url` or `id`, but not both.
26+
27+
`-f, --force`
28+
: Don't prompt for confirmation.
29+
```
30+
31+
<Global />
32+
33+
## Permissions
34+
35+
<Tabs>
36+
<TabItem value="Delegated">
37+
38+
| Resource | Permissions |
39+
|------------|----------------|
40+
| SharePoint | AllSites.Write |
41+
42+
</TabItem>
43+
<TabItem value="Application">
44+
45+
| Resource | Permissions |
46+
|------------|---------------------|
47+
| SharePoint | Sites.ReadWrite.All |
48+
49+
</TabItem>
50+
</Tabs>
51+
52+
## Examples
53+
54+
Unarchive a file without prompting for confirmation.
55+
56+
```sh
57+
m365 spo file unarchive --webUrl https://contoso.sharepoint.com/sites/Marketing --id 7a8c9207-7745-4cda-b0e2-be2618ee3030 --force
58+
```
59+
60+
Unarchive a file by URL with prompting for confirmation.
61+
62+
```sh
63+
m365 spo file unarchive --webUrl https://contoso.sharepoint.com/sites/Marketing --url '/sites/Marketing/shared documents/document.docx'
64+
```
65+
66+
## Response
67+
68+
The command won't return a response on success.

docs/src/config/sidebars.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2796,6 +2796,11 @@ const sidebars: SidebarsConfig = {
27962796
label: 'file sharinglink set',
27972797
id: 'cmd/spo/file/file-sharinglink-set'
27982798
},
2799+
{
2800+
type: 'doc',
2801+
label: 'file unarchive',
2802+
id: 'cmd/spo/file/file-unarchive'
2803+
},
27992804
{
28002805
type: 'doc',
28012806
label: 'file version clear',

src/m365/spo/commands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export default {
8484
FILE_SHARINGLINK_LIST: `${prefix} file sharinglink list`,
8585
FILE_SHARINGLINK_REMOVE: `${prefix} file sharinglink remove`,
8686
FILE_SHARINGLINK_SET: `${prefix} file sharinglink set`,
87+
FILE_UNARCHIVE: `${prefix} file unarchive`,
8788
FILE_VERSION_CLEAR: `${prefix} file version clear`,
8889
FILE_VERSION_GET: `${prefix} file version get`,
8990
FILE_VERSION_KEEP: `${prefix} file version keep`,

0 commit comments

Comments
 (0)