@pnp/cli-microsoft365 5.3.0-beta.ebb13d0 → 5.4.0-beta.694dbc5

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,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const GraphCommand_1 = require("../../../base/GraphCommand");
4
+ const utils_1 = require("../../../../utils");
5
+ const commands_1 = require("../../commands");
6
+ class SearchExternalConnectionListCommand extends GraphCommand_1.default {
7
+ get name() {
8
+ return commands_1.default.EXTERNALCONNECTION_LIST;
9
+ }
10
+ get description() {
11
+ return 'Lists external connections defined in the Microsoft Search';
12
+ }
13
+ defaultProperties() {
14
+ return ['id', 'name', 'state'];
15
+ }
16
+ commandAction(logger, args, cb) {
17
+ utils_1.odata
18
+ .getAllItems(`${this.resource}/v1.0/external/connections`)
19
+ .then((connections) => {
20
+ logger.log(connections);
21
+ cb();
22
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
23
+ }
24
+ }
25
+ module.exports = new SearchExternalConnectionListCommand();
26
+ //# sourceMappingURL=externalconnection-list.js.map
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const prefix = 'search';
4
4
  exports.default = {
5
- EXTERNALCONNECTION_ADD: `${prefix} externalconnection add`
5
+ EXTERNALCONNECTION_ADD: `${prefix} externalconnection add`,
6
+ EXTERNALCONNECTION_LIST: `${prefix} externalconnection list`
6
7
  };
7
8
  //# sourceMappingURL=commands.js.map
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const request_1 = require("../../../../request");
4
+ const utils_1 = require("../../../../utils");
5
+ const SpoCommand_1 = require("../../../base/SpoCommand");
6
+ const commands_1 = require("../../commands");
7
+ class SpoEventreceiverGetCommand extends SpoCommand_1.default {
8
+ get name() {
9
+ return commands_1.default.EVENTRECEIVER_GET;
10
+ }
11
+ get description() {
12
+ return 'Gets a specific event receiver attached to the web, site or list (if any of the list options are filled in) by receiver name of id';
13
+ }
14
+ getTelemetryProperties(args) {
15
+ const telemetryProps = super.getTelemetryProperties(args);
16
+ telemetryProps.listId = typeof args.options.listId !== 'undefined';
17
+ telemetryProps.listTitle = typeof args.options.listTitle !== 'undefined';
18
+ telemetryProps.listUrl = typeof args.options.listUrl !== 'undefined';
19
+ telemetryProps.scope = typeof args.options.scope !== 'undefined';
20
+ telemetryProps.id = typeof args.options.id !== 'undefined';
21
+ telemetryProps.name = typeof args.options.name !== 'undefined';
22
+ return telemetryProps;
23
+ }
24
+ commandAction(logger, args, cb) {
25
+ let requestUrl = `${args.options.webUrl}/_api/`;
26
+ let listUrl = '';
27
+ let filter = '?$filter=';
28
+ if (args.options.listId) {
29
+ listUrl = `lists(guid'${encodeURIComponent(args.options.listId)}')/`;
30
+ }
31
+ else if (args.options.listTitle) {
32
+ listUrl = `lists/getByTitle('${encodeURIComponent(args.options.listTitle)}')/`;
33
+ }
34
+ else if (args.options.listUrl) {
35
+ const listServerRelativeUrl = utils_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
36
+ listUrl = `GetList('${encodeURIComponent(listServerRelativeUrl)}')/`;
37
+ }
38
+ if (!args.options.scope || args.options.scope === 'web') {
39
+ requestUrl += `web/${listUrl}eventreceivers`;
40
+ }
41
+ else {
42
+ requestUrl += 'site/eventreceivers';
43
+ }
44
+ if (args.options.id) {
45
+ filter += `receiverid eq (guid'${args.options.id}')`;
46
+ }
47
+ else {
48
+ filter += `receivername eq '${args.options.name}'`;
49
+ }
50
+ const requestOptions = {
51
+ url: requestUrl + filter,
52
+ headers: {
53
+ 'accept': 'application/json;odata=nometadata'
54
+ },
55
+ responseType: 'json'
56
+ };
57
+ request_1.default
58
+ .get(requestOptions)
59
+ .then((res) => {
60
+ logger.log(res.value);
61
+ cb();
62
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
63
+ }
64
+ options() {
65
+ const options = [
66
+ {
67
+ option: '-u, --webUrl <webUrl>'
68
+ },
69
+ {
70
+ option: '--listTitle [listTitle]'
71
+ },
72
+ {
73
+ option: '--listId [listId]'
74
+ },
75
+ {
76
+ option: '--listUrl [listUrl]'
77
+ },
78
+ {
79
+ option: '-n, --name [name]'
80
+ },
81
+ {
82
+ option: '-i, --id [id]'
83
+ },
84
+ {
85
+ option: '-s, --scope [scope]',
86
+ autocomplete: ['web', 'site']
87
+ }
88
+ ];
89
+ const parentOptions = super.options();
90
+ return options.concat(parentOptions);
91
+ }
92
+ optionSets() {
93
+ return [
94
+ ['name', 'id']
95
+ ];
96
+ }
97
+ validate(args) {
98
+ const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
99
+ if (isValidSharePointUrl !== true) {
100
+ return isValidSharePointUrl;
101
+ }
102
+ const listOptions = [args.options.listId, args.options.listTitle, args.options.listUrl];
103
+ if (listOptions.some(item => item !== undefined) && listOptions.filter(item => item !== undefined).length > 1) {
104
+ return `Specify either list id or title or list url`;
105
+ }
106
+ if (args.options.listId && !utils_1.validation.isValidGuid(args.options.listId)) {
107
+ return `${args.options.listId} is not a valid GUID`;
108
+ }
109
+ if (args.options.scope && ['web', 'site'].indexOf(args.options.scope) === -1) {
110
+ return `${args.options.scope} is not a valid type value. Allowed values web|site.`;
111
+ }
112
+ if (args.options.scope && args.options.scope === 'site' && (args.options.listId || args.options.listUrl || args.options.listTitle)) {
113
+ return 'Scope cannot be set to site when retrieving list event receivers.';
114
+ }
115
+ return true;
116
+ }
117
+ }
118
+ module.exports = new SpoEventreceiverGetCommand();
119
+ //# sourceMappingURL=eventreceiver-get.js.map
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../../../../utils");
4
+ const request_1 = require("../../../../request");
5
+ const SpoCommand_1 = require("../../../base/SpoCommand");
6
+ const commands_1 = require("../../commands");
7
+ class SpoListViewAddCommand extends SpoCommand_1.default {
8
+ get name() {
9
+ return commands_1.default.LIST_VIEW_ADD;
10
+ }
11
+ get description() {
12
+ return 'Adds a new view to a SharePoint list.';
13
+ }
14
+ getTelemetryProperties(args) {
15
+ const telemetryProps = super.getTelemetryProperties(args);
16
+ telemetryProps.listId = typeof args.options.listId !== 'undefined';
17
+ telemetryProps.listTitle = typeof args.options.listTitle !== 'undefined';
18
+ telemetryProps.listUrl = typeof args.options.listUrl !== 'undefined';
19
+ telemetryProps.title = typeof args.options.title !== 'undefined';
20
+ telemetryProps.personal = !!args.options.personal;
21
+ telemetryProps.default = !!args.options.default;
22
+ telemetryProps.orderedView = !!args.options.orderedView;
23
+ telemetryProps.paged = !!args.options.paged;
24
+ telemetryProps.rowLimit = typeof args.options.rowLimit !== 'undefined';
25
+ return telemetryProps;
26
+ }
27
+ commandAction(logger, args, cb) {
28
+ const requestOptions = {
29
+ url: this.getRestUrl(args.options),
30
+ headers: {
31
+ 'content-type': 'application/json;odata=verbose',
32
+ accept: 'application/json;odata=nometadata'
33
+ },
34
+ responseType: 'json',
35
+ data: {
36
+ parameters: {
37
+ Title: args.options.title,
38
+ ViewFields: {
39
+ results: args.options.fields.split(',')
40
+ },
41
+ PersonalView: !!args.options.personal,
42
+ SetAsDefaultView: !!args.options.default,
43
+ Paged: !!args.options.paged,
44
+ RowLimit: args.options.rowLimit ? +args.options.rowLimit : 30
45
+ }
46
+ }
47
+ };
48
+ request_1.default
49
+ .post(requestOptions)
50
+ .then((result) => {
51
+ logger.log(result);
52
+ cb();
53
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
54
+ }
55
+ getRestUrl(options) {
56
+ let result = `${options.webUrl}/_api/web/`;
57
+ if (options.listId) {
58
+ result += `lists(guid'${encodeURIComponent(options.listId)}')`;
59
+ }
60
+ else if (options.listTitle) {
61
+ result += `lists/getByTitle('${encodeURIComponent(options.listTitle)}')`;
62
+ }
63
+ else if (options.listUrl) {
64
+ result += `GetList('${encodeURIComponent(utils_1.urlUtil.getServerRelativePath(options.webUrl, options.listUrl))}')`;
65
+ }
66
+ result += '/views/add';
67
+ return result;
68
+ }
69
+ optionSets() {
70
+ return [
71
+ ['listId', 'listTitle', 'listUrl']
72
+ ];
73
+ }
74
+ options() {
75
+ const options = [
76
+ { option: '-u, --webUrl <webUrl>' },
77
+ { option: '--listId [listId]' },
78
+ { option: '--listTitle [listTitle]' },
79
+ { option: '--listUrl [listUrl]' },
80
+ { option: '--title <title>' },
81
+ { option: '--fields <fields>' },
82
+ { option: '--personal' },
83
+ { option: '--default' },
84
+ { option: '--paged' },
85
+ { option: '--rowLimit [rowLimit]' }
86
+ ];
87
+ const parentOptions = super.options();
88
+ return options.concat(parentOptions);
89
+ }
90
+ validate(args) {
91
+ const webUrlValidation = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
92
+ if (webUrlValidation !== true) {
93
+ return webUrlValidation;
94
+ }
95
+ if (args.options.listId && !utils_1.validation.isValidGuid(args.options.listId)) {
96
+ return `${args.options.listId} in option listId is not a valid GUID`;
97
+ }
98
+ if (args.options.rowLimit !== undefined) {
99
+ if (isNaN(args.options.rowLimit)) {
100
+ return `${args.options.rowLimit} is not a number`;
101
+ }
102
+ if (+args.options.rowLimit <= 0) {
103
+ return 'rowLimit option must be greater than 0.';
104
+ }
105
+ }
106
+ if (args.options.personal && args.options.default) {
107
+ return 'Default view cannot be a personal view.';
108
+ }
109
+ return true;
110
+ }
111
+ }
112
+ module.exports = new SpoListViewAddCommand();
113
+ //# sourceMappingURL=list-view-add.js.map
@@ -35,6 +35,7 @@ exports.default = {
35
35
  CUSTOMACTION_SET: `${prefix} customaction set`,
36
36
  CUSTOMACTION_LIST: `${prefix} customaction list`,
37
37
  CUSTOMACTION_REMOVE: `${prefix} customaction remove`,
38
+ EVENTRECEIVER_GET: `${prefix} eventreceiver get`,
38
39
  EXTERNALUSER_LIST: `${prefix} externaluser list`,
39
40
  FEATURE_DISABLE: `${prefix} feature disable`,
40
41
  FEATURE_ENABLE: `${prefix} feature enable`,
@@ -100,6 +101,7 @@ exports.default = {
100
101
  LIST_ROLEINHERITANCE_RESET: `${prefix} list roleinheritance reset`,
101
102
  LIST_SET: `${prefix} list set`,
102
103
  LIST_SITESCRIPT_GET: `${prefix} list sitescript get`,
104
+ LIST_VIEW_ADD: `${prefix} list view add`,
103
105
  LIST_VIEW_GET: `${prefix} list view get`,
104
106
  LIST_VIEW_LIST: `${prefix} list view list`,
105
107
  LIST_VIEW_REMOVE: `${prefix} list view remove`,
@@ -0,0 +1,21 @@
1
+ # search externalconnection list
2
+
3
+ Lists external connections defined in Microsoft Search
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 search externalconnection list [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ --8<-- "docs/cmd/_global.md"
14
+
15
+ ## Examples
16
+
17
+ List external connections defined in Microsoft Search
18
+
19
+ ```sh
20
+ m365 search externalconnection list
21
+ ```
@@ -0,0 +1,70 @@
1
+ # spo eventreceiver get
2
+
3
+ Retrieves specific event receiver for the specified web, site or list by event receiver name or id.
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 spo eventreceiver get [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `-u, --webUrl <webUrl>`
14
+ : The URL of the web for which to retrieve the event receivers.
15
+
16
+ `--listTitle [listTitle]`
17
+ : The title of the list for which to retrieve the event receivers, _if the event receivers should be retrieved from a list_.
18
+ Specify either `listTitle`, `listId` or `listUrl`.
19
+
20
+ `--listId [listId]`
21
+ : The id of the list for which to retrieve the event receivers, _if the event receivers should be retrieved from a list_.
22
+ Specify either `listTitle`, `listId` or `listUrl`.
23
+
24
+ `--listUrl [listUrl]`
25
+ : The url of the list for which to retrieve the event receivers, _if the event receivers should be retrieved from a list_.
26
+ Specify either `listTitle`, `listId` or `listUrl`.
27
+
28
+ `-n, --name [name]`
29
+ The name of the event receiver to retrieve. Specify either `name` or `id` but not both.
30
+
31
+ `-i, --id [id]`
32
+ The id of the event receiver to retrieve. Specify either `name` or `id` but not both.
33
+
34
+ `-s, --scope [scope]`
35
+ : The scope of which to retrieve the Event Receivers.
36
+ Can be either "site" or "web". Defaults to "web". Only applicable when not specifying any of the list properties.
37
+
38
+ --8<-- "docs/cmd/_global.md"
39
+
40
+ ## Examples
41
+
42
+ Retrieve event receivers in web _<https://contoso.sharepoint.com/sites/contoso-sales>_ with name _PnP Test Receiver_.
43
+
44
+ ```sh
45
+ m365 spo eventreceiver list --webUrl https://contoso.sharepoint.com/sites/contoso-sales --name 'PnP Test Receiver'
46
+ ```
47
+
48
+ Retrieve event receivers in site _<https://contoso.sharepoint.com/sites/contoso-sales>_ with id _c5a6444a-9c7f-4a0d-9e29-fc6fe30e34ec_.
49
+
50
+ ```sh
51
+ m365 spo eventreceiver list --webUrl https://contoso.sharepoint.com/sites/contoso-sales --scope site --id c5a6444a-9c7f-4a0d-9e29-fc6fe30e34ec
52
+ ```
53
+
54
+ Retrieve event receivers for list with title _Events_ in web _<https://contoso.sharepoint.com/sites/contoso-sales>_ with name _PnP Test Receiver_.
55
+
56
+ ```sh
57
+ m365 spo eventreceiver list --webUrl https://contoso.sharepoint.com/sites/contoso-sales --listTitle Events --name 'PnP Test Receiver'
58
+ ```
59
+
60
+ Retrieve event receivers for list with ID _202b8199-b9de-43fd-9737-7f213f51c991_ in web _<https://contoso.sharepoint.com/sites/contoso-sales>_ with id _c5a6444a-9c7f-4a0d-9e29-fc6fe30e34ec_.
61
+
62
+ ```sh
63
+ m365 spo eventreceiver list --webUrl https://contoso.sharepoint.com/sites/contoso-sales --listId '202b8199-b9de-43fd-9737-7f213f51c991' --id c5a6444a-9c7f-4a0d-9e29-fc6fe30e34ec
64
+ ```
65
+
66
+ Retrieve event receivers for list with url _/sites/contoso-sales/lists/Events_ in web _<https://contoso.sharepoint.com/sites/contoso-sales>_ with name _PnP Test Receiver_.
67
+
68
+ ```sh
69
+ m365 spo eventreceiver list --webUrl https://contoso.sharepoint.com/sites/contoso-sales --listUrl '/sites/contoso-sales/lists/Events' --name 'PnP Test Receiver'
70
+ ```
@@ -0,0 +1,67 @@
1
+ # spo list view add
2
+
3
+ Adds a new view to a SharePoint list
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 spo list view add [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `-u, --webUrl <webUrl>`
14
+ : URL of the site where the list is located.
15
+
16
+ `--listId [listId]`
17
+ : ID of the list to which the view should be added. Specify either `listId`, `listTitle` or `listUrl` but not multiple.
18
+
19
+ `--listTitle [listTitle]`
20
+ : Title of the list to which the view should be added. Specify either `listId`, `listTitle` or `listUrl` but not multiple.
21
+
22
+ `--listUrl [listUrl]`
23
+ : Relative URL of the list to which the view should be added. Specify either `listId`, `listTitle` or `listUrl` but not multiple.
24
+
25
+ `--title <title>`
26
+ : Title of the view to be created for the list.
27
+
28
+ `--fields <fields>`
29
+ : Comma-separated list of **case-sensitive** internal names of the fields to add to the view.
30
+
31
+ `--personal`
32
+ : View will be created as personal view, if specified.
33
+
34
+ `--default`
35
+ : View will be set as default view, if specified.
36
+
37
+ `--paged`
38
+ : View supports paging, if specified (recommended to use this).
39
+
40
+ `--rowLimit [rowLimit]`
41
+ : Sets the number of items to display for the view. Default value is 30.
42
+
43
+ --8<-- "docs/cmd/_global.md"
44
+
45
+ ## Remarks
46
+
47
+ We recommend using the `paged` option. When specified, the view supports displaying more items page by page (default behavior). When not specified, the `rowLimit` is absolute, and there is no link to see more items.
48
+
49
+ ## Examples
50
+
51
+ Add a view called _All events_ to a list with specific title.
52
+
53
+ ```sh
54
+ spo list view add --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle "My List" --title "All events" --fields "FieldName1,FieldName2,Created,Author,Modified,Editor" --paged
55
+ ```
56
+
57
+ Add a view as default view with title _All events_ to a list with a specific URL.
58
+
59
+ ```sh
60
+ spo list view add --webUrl https://contoso.sharepoint.com/sites/project-x --listUrl "/Lists/MyList" --title "All events" --fields "FieldName1,Created" --paged --default
61
+ ```
62
+
63
+ Add a personal view called _All events_ to a list with a specific ID.
64
+
65
+ ```sh
66
+ spo list view add --webUrl https://contoso.sharepoint.com/sites/project-x --listId 00000000-0000-0000-0000-000000000000 --title "All events" --fields "FieldName1,Created" --paged --personal
67
+ ```
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "5.3.0",
3
+ "version": "5.4.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@pnp/cli-microsoft365",
9
- "version": "5.3.0",
9
+ "version": "5.4.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@azure/msal-node": "^1.8.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "5.3.0-beta.ebb13d0",
3
+ "version": "5.4.0-beta.694dbc5",
4
4
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",
@@ -174,6 +174,7 @@
174
174
  "van Iersel, Cas <cvaniersel@portiva.nl>",
175
175
  "van Rousselt, Rick <rick.vanrousselt@outlook.com>",
176
176
  "Velliah, Joseph <joseph@sprider.org>",
177
+ "Verbeeck, Mathijs <verbeeckmathijs@gmail.com>",
177
178
  "Waegebaert, Jasey <jaseyw@gmigroup.be>",
178
179
  "Wilen, Wictor <wictor@wictorwilen.se>",
179
180
  "Williams, Rabia <rabiawilliams@gmail.com>",