@pnp/cli-microsoft365 5.0.0-beta.ccc8737 → 5.0.0-beta.cdbc898
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const request_1 = require("../../../../request");
|
|
4
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
5
|
+
const commands_1 = require("../../commands");
|
|
6
|
+
class SpoSiteRecycleBinItemListCommand extends SpoCommand_1.default {
|
|
7
|
+
get name() {
|
|
8
|
+
return commands_1.default.SITE_RECYCLEBINITEM_LIST;
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return 'Lists items from recycle bin';
|
|
12
|
+
}
|
|
13
|
+
defaultProperties() {
|
|
14
|
+
return ['Id', 'Title', 'DirName'];
|
|
15
|
+
}
|
|
16
|
+
commandAction(logger, args, cb) {
|
|
17
|
+
if (this.verbose) {
|
|
18
|
+
logger.logToStderr(`Retrieving all items from recycle bin at ${args.options.siteUrl}...`);
|
|
19
|
+
}
|
|
20
|
+
const state = args.options.secondary ? '2' : '1';
|
|
21
|
+
let requestUrl = `${args.options.siteUrl}/_api/site/RecycleBin?$filter=(ItemState eq ${state})`;
|
|
22
|
+
if (typeof args.options.type !== 'undefined') {
|
|
23
|
+
const type = SpoSiteRecycleBinItemListCommand.recycleBinItemType.find(item => item.value === args.options.type);
|
|
24
|
+
if (typeof type !== 'undefined') {
|
|
25
|
+
requestUrl += ` and (ItemType eq ${type.id})`;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const requestOptions = {
|
|
29
|
+
url: requestUrl,
|
|
30
|
+
headers: {
|
|
31
|
+
'accept': 'application/json;odata=nometadata'
|
|
32
|
+
},
|
|
33
|
+
responseType: 'json'
|
|
34
|
+
};
|
|
35
|
+
request_1.default
|
|
36
|
+
.get(requestOptions)
|
|
37
|
+
.then((response) => {
|
|
38
|
+
logger.log(response.value);
|
|
39
|
+
cb();
|
|
40
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
41
|
+
}
|
|
42
|
+
options() {
|
|
43
|
+
const options = [
|
|
44
|
+
{
|
|
45
|
+
option: '-u, --siteUrl <siteUrl>'
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
option: '-t, --type [type]',
|
|
49
|
+
autocomplete: SpoSiteRecycleBinItemListCommand.recycleBinItemType.map(item => item.value)
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
option: '-s, --secondary'
|
|
53
|
+
}
|
|
54
|
+
];
|
|
55
|
+
const parentOptions = super.options();
|
|
56
|
+
return options.concat(parentOptions);
|
|
57
|
+
}
|
|
58
|
+
validate(args) {
|
|
59
|
+
const isValidSharePointUrl = SpoCommand_1.default.isValidSharePointUrl(args.options.siteUrl);
|
|
60
|
+
if (isValidSharePointUrl !== true) {
|
|
61
|
+
return isValidSharePointUrl;
|
|
62
|
+
}
|
|
63
|
+
if (typeof args.options.type !== 'undefined' &&
|
|
64
|
+
!SpoSiteRecycleBinItemListCommand.recycleBinItemType.some(item => item.value === args.options.type)) {
|
|
65
|
+
return `${args.options.type} is not a valid value. Allowed values are ${SpoSiteRecycleBinItemListCommand.recycleBinItemType.map(item => item.value).join(', ')}`;
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
SpoSiteRecycleBinItemListCommand.recycleBinItemType = [
|
|
71
|
+
{ id: 1, value: 'files' },
|
|
72
|
+
{ id: 3, value: 'listItems' },
|
|
73
|
+
{ id: 5, value: 'folders' }
|
|
74
|
+
];
|
|
75
|
+
module.exports = new SpoSiteRecycleBinItemListCommand();
|
|
76
|
+
//# sourceMappingURL=site-recyclebinitem-list.js.map
|
|
@@ -183,6 +183,7 @@ exports.default = {
|
|
|
183
183
|
SITE_GROUPIFY: `${prefix} site groupify`,
|
|
184
184
|
SITE_LIST: `${prefix} site list`,
|
|
185
185
|
SITE_INPLACERECORDSMANAGEMENT_SET: `${prefix} site inplacerecordsmanagement set`,
|
|
186
|
+
SITE_RECYCLEBINITEM_LIST: `${prefix} site recyclebinitem list`,
|
|
186
187
|
SITE_REMOVE: `${prefix} site remove`,
|
|
187
188
|
SITE_RENAME: `${prefix} site rename`,
|
|
188
189
|
SITE_SET: `${prefix} site set`,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# spo site recyclebinitem list
|
|
2
|
+
|
|
3
|
+
Lists items from recycle bin
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
m365 spo site recyclebinitem list [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
`-u, --siteUrl <siteUrl>`
|
|
14
|
+
: URL of the site for which to retrieve the recycle bin items
|
|
15
|
+
|
|
16
|
+
`--type [type]`
|
|
17
|
+
: Type of items which should be retrieved (listItems, folders, files)
|
|
18
|
+
|
|
19
|
+
`--secondary`
|
|
20
|
+
: Use this switch to retrieve items from secondary recycle bin
|
|
21
|
+
|
|
22
|
+
--8<-- "docs/cmd/_global.md"
|
|
23
|
+
|
|
24
|
+
## Remarks
|
|
25
|
+
|
|
26
|
+
When type is not specified then the command will return all items in the recycle bin
|
|
27
|
+
|
|
28
|
+
## Examples
|
|
29
|
+
|
|
30
|
+
Lists all files, items and folders from recycle bin for site _https://contoso.sharepoint.com/site_
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
m365 spo site recyclebinitem list --siteUrl https://contoso.sharepoint.com/site
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Lists only files from recycle bin for site _https://contoso.sharepoint.com/site_
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
m365 spo site recyclebinitem list --siteUrl https://contoso.sharepoint.com/site --type files
|
|
40
|
+
```
|
package/package.json
CHANGED