@pnp/cli-microsoft365 6.0.0-beta.e1e0a1b → 6.0.0-beta.f94d570
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.
- package/dist/m365/spo/commands/field/field-get.js +14 -5
- package/dist/m365/spo/commands/field/field-remove.js +19 -10
- package/dist/m365/spo/commands/file/file-rename.js +108 -0
- package/dist/m365/spo/commands/group/group-get.js +26 -6
- package/dist/m365/spo/commands/site/site-apppermission-add.js +3 -6
- package/dist/m365/spo/commands/site/site-apppermission-set.js +3 -6
- package/dist/m365/spo/commands.js +1 -0
- package/dist/m365/teams/commands/tab/tab-get.js +2 -2
- package/dist/m365/teams/commands/team/team-clone.js +33 -7
- package/dist/m365/teams/commands/team/team-set.js +25 -5
- package/docs/docs/cmd/spo/field/field-get.md +6 -3
- package/docs/docs/cmd/spo/field/field-remove.md +9 -6
- package/docs/docs/cmd/spo/file/file-rename.md +43 -0
- package/docs/docs/cmd/spo/group/group-get.md +12 -3
- package/docs/docs/cmd/spo/site/site-apppermission-add.md +1 -1
- package/docs/docs/cmd/spo/site/site-apppermission-set.md +1 -1
- package/docs/docs/cmd/teams/tab/tab-get.md +2 -2
- package/docs/docs/cmd/teams/team/team-clone.md +11 -5
- package/docs/docs/cmd/teams/team/team-set.md +10 -4
- package/package.json +1 -1
|
@@ -17,10 +17,19 @@ class SpoFieldGetCommand extends SpoCommand_1.default {
|
|
|
17
17
|
telemetryProps.listTitle = typeof args.options.listTitle !== 'undefined';
|
|
18
18
|
telemetryProps.listUrl = typeof args.options.listUrl !== 'undefined';
|
|
19
19
|
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
20
|
-
telemetryProps.
|
|
20
|
+
telemetryProps.title = typeof args.options.title !== 'undefined';
|
|
21
21
|
return telemetryProps;
|
|
22
22
|
}
|
|
23
|
+
optionSets() {
|
|
24
|
+
return [
|
|
25
|
+
['id', 'title', 'fieldTitle']
|
|
26
|
+
];
|
|
27
|
+
}
|
|
23
28
|
commandAction(logger, args, cb) {
|
|
29
|
+
if (args.options.fieldTitle) {
|
|
30
|
+
args.options.title = args.options.fieldTitle;
|
|
31
|
+
this.warn(logger, `Option 'fieldTitle' is deprecated. Please use 'title' instead.`);
|
|
32
|
+
}
|
|
24
33
|
let listRestUrl = '';
|
|
25
34
|
if (args.options.listId) {
|
|
26
35
|
listRestUrl = `lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')/`;
|
|
@@ -37,7 +46,7 @@ class SpoFieldGetCommand extends SpoCommand_1.default {
|
|
|
37
46
|
fieldRestUrl = `/getbyid('${utils_1.formatting.encodeQueryParameter(args.options.id)}')`;
|
|
38
47
|
}
|
|
39
48
|
else {
|
|
40
|
-
fieldRestUrl = `/getbyinternalnameortitle('${utils_1.formatting.encodeQueryParameter(args.options.
|
|
49
|
+
fieldRestUrl = `/getbyinternalnameortitle('${utils_1.formatting.encodeQueryParameter(args.options.title)}')`;
|
|
41
50
|
}
|
|
42
51
|
const requestOptions = {
|
|
43
52
|
url: `${args.options.webUrl}/_api/web/${listRestUrl}fields${fieldRestUrl}`,
|
|
@@ -72,6 +81,9 @@ class SpoFieldGetCommand extends SpoCommand_1.default {
|
|
|
72
81
|
},
|
|
73
82
|
{
|
|
74
83
|
option: '--fieldTitle [fieldTitle]'
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
option: '-t, --title [title]'
|
|
75
87
|
}
|
|
76
88
|
];
|
|
77
89
|
const parentOptions = super.options();
|
|
@@ -82,9 +94,6 @@ class SpoFieldGetCommand extends SpoCommand_1.default {
|
|
|
82
94
|
if (isValidSharePointUrl !== true) {
|
|
83
95
|
return isValidSharePointUrl;
|
|
84
96
|
}
|
|
85
|
-
if (!args.options.id && !args.options.fieldTitle) {
|
|
86
|
-
return 'Specify id or fieldTitle, one is required';
|
|
87
|
-
}
|
|
88
97
|
if (args.options.id && !utils_1.validation.isValidGuid(args.options.id)) {
|
|
89
98
|
return `${args.options.id} is not a valid GUID`;
|
|
90
99
|
}
|
|
@@ -19,11 +19,20 @@ class SpoFieldRemoveCommand extends SpoCommand_1.default {
|
|
|
19
19
|
telemetryProps.listUrl = typeof args.options.listUrl !== 'undefined';
|
|
20
20
|
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
21
21
|
telemetryProps.group = typeof args.options.group !== 'undefined';
|
|
22
|
-
telemetryProps.
|
|
22
|
+
telemetryProps.title = typeof args.options.title !== 'undefined';
|
|
23
23
|
telemetryProps.confirm = (!(!args.options.confirm)).toString();
|
|
24
24
|
return telemetryProps;
|
|
25
25
|
}
|
|
26
|
+
optionSets() {
|
|
27
|
+
return [
|
|
28
|
+
['id', 'title', 'fieldTitle', 'group']
|
|
29
|
+
];
|
|
30
|
+
}
|
|
26
31
|
commandAction(logger, args, cb) {
|
|
32
|
+
if (args.options.fieldTitle) {
|
|
33
|
+
args.options.title = args.options.fieldTitle;
|
|
34
|
+
this.warn(logger, `Option 'fieldTitle' is deprecated. Please use 'title' instead.`);
|
|
35
|
+
}
|
|
27
36
|
let messageEnd;
|
|
28
37
|
if (args.options.listId || args.options.listTitle) {
|
|
29
38
|
messageEnd = `in list ${args.options.listId || args.options.listTitle}`;
|
|
@@ -31,16 +40,16 @@ class SpoFieldRemoveCommand extends SpoCommand_1.default {
|
|
|
31
40
|
else {
|
|
32
41
|
messageEnd = `in site ${args.options.webUrl}`;
|
|
33
42
|
}
|
|
34
|
-
const removeField = (listRestUrl, fieldId,
|
|
43
|
+
const removeField = (listRestUrl, fieldId, title) => {
|
|
35
44
|
if (this.verbose) {
|
|
36
|
-
logger.logToStderr(`Removing field ${fieldId ||
|
|
45
|
+
logger.logToStderr(`Removing field ${fieldId || title} ${messageEnd}...`);
|
|
37
46
|
}
|
|
38
47
|
let fieldRestUrl = '';
|
|
39
48
|
if (fieldId) {
|
|
40
49
|
fieldRestUrl = `/getbyid('${utils_1.formatting.encodeQueryParameter(fieldId)}')`;
|
|
41
50
|
}
|
|
42
51
|
else {
|
|
43
|
-
fieldRestUrl = `/getbyinternalnameortitle('${utils_1.formatting.encodeQueryParameter(
|
|
52
|
+
fieldRestUrl = `/getbyinternalnameortitle('${utils_1.formatting.encodeQueryParameter(title)}')`;
|
|
44
53
|
}
|
|
45
54
|
const requestOptions = {
|
|
46
55
|
url: `${args.options.webUrl}/_api/web/${listRestUrl}fields${fieldRestUrl}`,
|
|
@@ -97,7 +106,7 @@ class SpoFieldRemoveCommand extends SpoCommand_1.default {
|
|
|
97
106
|
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
98
107
|
}
|
|
99
108
|
else {
|
|
100
|
-
removeField(listRestUrl, args.options.id, args.options.
|
|
109
|
+
removeField(listRestUrl, args.options.id, args.options.title)
|
|
101
110
|
.then(() => {
|
|
102
111
|
// REST post call doesn't return anything
|
|
103
112
|
cb();
|
|
@@ -108,7 +117,7 @@ class SpoFieldRemoveCommand extends SpoCommand_1.default {
|
|
|
108
117
|
prepareRemoval();
|
|
109
118
|
}
|
|
110
119
|
else {
|
|
111
|
-
const confirmMessage = `Are you sure you want to remove the ${args.options.group ? 'fields' : 'field'} ${args.options.id || args.options.
|
|
120
|
+
const confirmMessage = `Are you sure you want to remove the ${args.options.group ? 'fields' : 'field'} ${args.options.id || args.options.title || 'from group ' + args.options.group} ${messageEnd}?`;
|
|
112
121
|
cli_1.Cli.prompt({
|
|
113
122
|
type: 'confirm',
|
|
114
123
|
name: 'continue',
|
|
@@ -142,7 +151,10 @@ class SpoFieldRemoveCommand extends SpoCommand_1.default {
|
|
|
142
151
|
option: '-i, --id [id]'
|
|
143
152
|
},
|
|
144
153
|
{
|
|
145
|
-
option: '
|
|
154
|
+
option: '--fieldTitle [fieldTitle]'
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
option: '-t, --title [title]'
|
|
146
158
|
},
|
|
147
159
|
{
|
|
148
160
|
option: '-g, --group [group]'
|
|
@@ -159,9 +171,6 @@ class SpoFieldRemoveCommand extends SpoCommand_1.default {
|
|
|
159
171
|
if (isValidSharePointUrl !== true) {
|
|
160
172
|
return isValidSharePointUrl;
|
|
161
173
|
}
|
|
162
|
-
if (!args.options.id && !args.options.fieldTitle && !args.options.group) {
|
|
163
|
-
return 'Specify id, fieldTitle, or group. One is required';
|
|
164
|
-
}
|
|
165
174
|
if (args.options.id && !utils_1.validation.isValidGuid(args.options.id)) {
|
|
166
175
|
return `${args.options.id} is not a valid GUID`;
|
|
167
176
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cli_1 = require("../../../../cli");
|
|
4
|
+
const request_1 = require("../../../../request");
|
|
5
|
+
const utils_1 = require("../../../../utils");
|
|
6
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
7
|
+
const commands_1 = require("../../commands");
|
|
8
|
+
const removeCommand = require('./file-remove');
|
|
9
|
+
class SpoFileRenameCommand extends SpoCommand_1.default {
|
|
10
|
+
get name() {
|
|
11
|
+
return commands_1.default.FILE_RENAME;
|
|
12
|
+
}
|
|
13
|
+
get description() {
|
|
14
|
+
return 'Renames a file';
|
|
15
|
+
}
|
|
16
|
+
getTelemetryProperties(args) {
|
|
17
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
18
|
+
telemetryProps.force = !!args.options.force;
|
|
19
|
+
return telemetryProps;
|
|
20
|
+
}
|
|
21
|
+
commandAction(logger, args, cb) {
|
|
22
|
+
const webUrl = args.options.webUrl;
|
|
23
|
+
const originalFileServerRelativeUrl = utils_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.sourceUrl);
|
|
24
|
+
this
|
|
25
|
+
.getFile(originalFileServerRelativeUrl, webUrl)
|
|
26
|
+
.then((_) => {
|
|
27
|
+
if (args.options.force) {
|
|
28
|
+
return this.deleteFile(webUrl, args.options.sourceUrl, args.options.targetFileName);
|
|
29
|
+
}
|
|
30
|
+
return Promise.resolve();
|
|
31
|
+
})
|
|
32
|
+
.then(_ => {
|
|
33
|
+
const requestBody = {
|
|
34
|
+
formValues: [{
|
|
35
|
+
FieldName: 'FileLeafRef',
|
|
36
|
+
FieldValue: args.options.targetFileName
|
|
37
|
+
}]
|
|
38
|
+
};
|
|
39
|
+
const requestOptions = {
|
|
40
|
+
url: `${webUrl}/_api/web/GetFileByServerRelativeUrl('${encodeURIComponent(originalFileServerRelativeUrl)}')/ListItemAllFields/ValidateUpdateListItem()`,
|
|
41
|
+
headers: {
|
|
42
|
+
'accept': 'application/json;odata=nometadata'
|
|
43
|
+
},
|
|
44
|
+
data: requestBody,
|
|
45
|
+
responseType: 'json'
|
|
46
|
+
};
|
|
47
|
+
return request_1.default.post(requestOptions);
|
|
48
|
+
})
|
|
49
|
+
.then((resp) => {
|
|
50
|
+
logger.log(resp.value);
|
|
51
|
+
cb();
|
|
52
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
53
|
+
}
|
|
54
|
+
getFile(originalFileServerRelativeUrl, webUrl) {
|
|
55
|
+
const requestUrl = `${webUrl}/_api/web/GetFileByServerRelativeUrl('${encodeURIComponent(originalFileServerRelativeUrl)}')?$select=UniqueId`;
|
|
56
|
+
const requestOptions = {
|
|
57
|
+
url: requestUrl,
|
|
58
|
+
headers: {
|
|
59
|
+
'accept': 'application/json;odata=nometadata'
|
|
60
|
+
},
|
|
61
|
+
responseType: 'json'
|
|
62
|
+
};
|
|
63
|
+
return request_1.default.get(requestOptions);
|
|
64
|
+
}
|
|
65
|
+
deleteFile(webUrl, sourceUrl, targetFileName) {
|
|
66
|
+
const targetFileServerRelativeUrl = `${utils_1.urlUtil.getServerRelativePath(webUrl, sourceUrl.substring(0, sourceUrl.lastIndexOf('/')))}/${targetFileName}`;
|
|
67
|
+
const options = {
|
|
68
|
+
webUrl: webUrl,
|
|
69
|
+
url: targetFileServerRelativeUrl,
|
|
70
|
+
recycle: true,
|
|
71
|
+
confirm: true,
|
|
72
|
+
debug: this.debug,
|
|
73
|
+
verbose: this.verbose
|
|
74
|
+
};
|
|
75
|
+
return cli_1.Cli.executeCommandWithOutput(removeCommand, { options: Object.assign(Object.assign({}, options), { _: [] }) })
|
|
76
|
+
.then(_ => {
|
|
77
|
+
return Promise.resolve();
|
|
78
|
+
}, (err) => {
|
|
79
|
+
if (err.error !== null && err.error.message !== null && err.error.message.includes('does not exist')) {
|
|
80
|
+
return Promise.resolve();
|
|
81
|
+
}
|
|
82
|
+
return Promise.reject(err);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
options() {
|
|
86
|
+
const options = [
|
|
87
|
+
{
|
|
88
|
+
option: '-u, --webUrl <webUrl>'
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
option: '-s, --sourceUrl <sourceUrl>'
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
option: '-t, --targetFileName <targetFileName>'
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
option: '--force'
|
|
98
|
+
}
|
|
99
|
+
];
|
|
100
|
+
const parentOptions = super.options();
|
|
101
|
+
return options.concat(parentOptions);
|
|
102
|
+
}
|
|
103
|
+
validate(args) {
|
|
104
|
+
return utils_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
module.exports = new SpoFileRenameCommand();
|
|
108
|
+
//# sourceMappingURL=file-rename.js.map
|
|
@@ -15,6 +15,7 @@ class SpoGroupGetCommand extends SpoCommand_1.default {
|
|
|
15
15
|
const telemetryProps = super.getTelemetryProperties(args);
|
|
16
16
|
telemetryProps.id = (!(!args.options.id)).toString();
|
|
17
17
|
telemetryProps.name = (!(!args.options.name)).toString();
|
|
18
|
+
telemetryProps.associatedGroup = args.options.associatedGroup;
|
|
18
19
|
return telemetryProps;
|
|
19
20
|
}
|
|
20
21
|
commandAction(logger, args, cb) {
|
|
@@ -28,6 +29,19 @@ class SpoGroupGetCommand extends SpoCommand_1.default {
|
|
|
28
29
|
else if (args.options.name) {
|
|
29
30
|
requestUrl = `${args.options.webUrl}/_api/web/sitegroups/GetByName('${encodeURIComponent(args.options.name)}')`;
|
|
30
31
|
}
|
|
32
|
+
else if (args.options.associatedGroup) {
|
|
33
|
+
switch (args.options.associatedGroup.toLowerCase()) {
|
|
34
|
+
case 'owner':
|
|
35
|
+
requestUrl = `${args.options.webUrl}/_api/web/AssociatedOwnerGroup`;
|
|
36
|
+
break;
|
|
37
|
+
case 'member':
|
|
38
|
+
requestUrl = `${args.options.webUrl}/_api/web/AssociatedMemberGroup`;
|
|
39
|
+
break;
|
|
40
|
+
case 'visitor':
|
|
41
|
+
requestUrl = `${args.options.webUrl}/_api/web/AssociatedVisitorGroup`;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
31
45
|
const requestOptions = {
|
|
32
46
|
url: requestUrl,
|
|
33
47
|
method: 'GET',
|
|
@@ -53,21 +67,27 @@ class SpoGroupGetCommand extends SpoCommand_1.default {
|
|
|
53
67
|
},
|
|
54
68
|
{
|
|
55
69
|
option: '--name [name]'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
option: '--associatedGroup [associatedGroup]',
|
|
73
|
+
autocomplete: ['Owner', 'Member', 'Visitor']
|
|
56
74
|
}
|
|
57
75
|
];
|
|
58
76
|
const parentOptions = super.options();
|
|
59
77
|
return options.concat(parentOptions);
|
|
60
78
|
}
|
|
79
|
+
optionSets() {
|
|
80
|
+
return [
|
|
81
|
+
['id', 'name', 'associatedGroup']
|
|
82
|
+
];
|
|
83
|
+
}
|
|
61
84
|
validate(args) {
|
|
62
|
-
if (args.options.id && args.options.name) {
|
|
63
|
-
return 'Use either "id" or "name", but not all.';
|
|
64
|
-
}
|
|
65
|
-
if (!args.options.id && !args.options.name) {
|
|
66
|
-
return 'Specify id or name, one is required';
|
|
67
|
-
}
|
|
68
85
|
if (args.options.id && isNaN(args.options.id)) {
|
|
69
86
|
return `Specified id ${args.options.id} is not a number`;
|
|
70
87
|
}
|
|
88
|
+
if (args.options.associatedGroup && ['owner', 'member', 'visitor'].indexOf(args.options.associatedGroup.toLowerCase()) === -1) {
|
|
89
|
+
return `${args.options.associatedGroup} is not a valid associatedGroup value. Allowed values are Owner|Member|Visitor.`;
|
|
90
|
+
}
|
|
71
91
|
return utils_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
72
92
|
}
|
|
73
93
|
}
|
|
@@ -73,7 +73,7 @@ class SpoSiteAppPermissionAddCommand extends GraphCommand_1.default {
|
|
|
73
73
|
}
|
|
74
74
|
mapRequestBody(permission, appInfo) {
|
|
75
75
|
const requestBody = {
|
|
76
|
-
roles: permission
|
|
76
|
+
roles: [permission]
|
|
77
77
|
};
|
|
78
78
|
requestBody.grantedToIdentities = [];
|
|
79
79
|
requestBody.grantedToIdentities.push({ application: { "id": appInfo.appId, "displayName": appInfo.displayName } });
|
|
@@ -129,11 +129,8 @@ class SpoSiteAppPermissionAddCommand extends GraphCommand_1.default {
|
|
|
129
129
|
if (args.options.appId && !utils_1.validation.isValidGuid(args.options.appId)) {
|
|
130
130
|
return `${args.options.appId} is not a valid GUID`;
|
|
131
131
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (['read', 'write'].indexOf(permissions[i]) === -1) {
|
|
135
|
-
return `${permissions[i]} is not a valid permission value. Allowed values read|write|read,write`;
|
|
136
|
-
}
|
|
132
|
+
if (['read', 'write', 'owner'].indexOf(args.options.permission) === -1) {
|
|
133
|
+
return `${args.options.permission} is not a valid permission value. Allowed values are read|write|owner`;
|
|
137
134
|
}
|
|
138
135
|
return utils_1.validation.isValidSharePointUrl(args.options.siteUrl);
|
|
139
136
|
}
|
|
@@ -83,7 +83,7 @@ class SpoSiteAppPermissionSetCommand extends GraphCommand_1.default {
|
|
|
83
83
|
'content-type': 'application/json;odata=nometadata'
|
|
84
84
|
},
|
|
85
85
|
data: {
|
|
86
|
-
roles: args.options.permission
|
|
86
|
+
roles: [args.options.permission]
|
|
87
87
|
},
|
|
88
88
|
responseType: 'json'
|
|
89
89
|
};
|
|
@@ -122,11 +122,8 @@ class SpoSiteAppPermissionSetCommand extends GraphCommand_1.default {
|
|
|
122
122
|
if (args.options.appId && !utils_1.validation.isValidGuid(args.options.appId)) {
|
|
123
123
|
return `${args.options.appId} is not a valid GUID`;
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (['read', 'write'].indexOf(permissions[i]) === -1) {
|
|
128
|
-
return `${permissions[i]} is not a valid permission value. Allowed values are read|write|read,write`;
|
|
129
|
-
}
|
|
125
|
+
if (['read', 'write', 'owner'].indexOf(args.options.permission) === -1) {
|
|
126
|
+
return `${args.options.permission} is not a valid permission value. Allowed values are read|write|owner`;
|
|
130
127
|
}
|
|
131
128
|
return utils_1.validation.isValidSharePointUrl(args.options.siteUrl);
|
|
132
129
|
}
|
|
@@ -54,6 +54,7 @@ exports.default = {
|
|
|
54
54
|
FILE_LIST: `${prefix} file list`,
|
|
55
55
|
FILE_MOVE: `${prefix} file move`,
|
|
56
56
|
FILE_REMOVE: `${prefix} file remove`,
|
|
57
|
+
FILE_RENAME: `${prefix} file rename`,
|
|
57
58
|
FILE_SHARINGINFO_GET: `${prefix} file sharinginfo get`,
|
|
58
59
|
FOLDER_ADD: `${prefix} folder add`,
|
|
59
60
|
FOLDER_COPY: `${prefix} folder copy`,
|
|
@@ -124,10 +124,10 @@ class TeamsTabGetCommand extends GraphCommand_1.default {
|
|
|
124
124
|
option: '--channelName [channelName]'
|
|
125
125
|
},
|
|
126
126
|
{
|
|
127
|
-
option: '--tabId [tabId]'
|
|
127
|
+
option: '-i, --tabId [tabId]'
|
|
128
128
|
},
|
|
129
129
|
{
|
|
130
|
-
option: '--tabName [tabName]'
|
|
130
|
+
option: '-n, --tabName [tabName]'
|
|
131
131
|
}
|
|
132
132
|
];
|
|
133
133
|
const parentOptions = super.options();
|
|
@@ -15,13 +15,24 @@ class TeamsTeamCloneCommand extends GraphCommand_1.default {
|
|
|
15
15
|
const telemetryProps = super.getTelemetryProperties(args);
|
|
16
16
|
telemetryProps.description = typeof args.options.description !== 'undefined';
|
|
17
17
|
telemetryProps.classification = typeof args.options.classification !== 'undefined';
|
|
18
|
-
telemetryProps.
|
|
18
|
+
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
19
|
+
telemetryProps.teamId = typeof args.options.teamId !== 'undefined';
|
|
20
|
+
telemetryProps.name = typeof args.options.name !== 'undefined';
|
|
21
|
+
telemetryProps.displayName = typeof args.options.displayName !== 'undefined';
|
|
19
22
|
return telemetryProps;
|
|
20
23
|
}
|
|
21
24
|
commandAction(logger, args, cb) {
|
|
25
|
+
if (args.options.teamId) {
|
|
26
|
+
args.options.id = args.options.teamId;
|
|
27
|
+
this.warn(logger, `Option 'teamId' is deprecated. Please use 'id' instead.`);
|
|
28
|
+
}
|
|
29
|
+
if (args.options.displayName) {
|
|
30
|
+
args.options.name = args.options.displayName;
|
|
31
|
+
this.warn(logger, `Option 'displayName' is deprecated. Please use 'name' instead.`);
|
|
32
|
+
}
|
|
22
33
|
const data = {
|
|
23
|
-
displayName: args.options.
|
|
24
|
-
mailNickname: this.generateMailNickname(args.options.
|
|
34
|
+
displayName: args.options.name,
|
|
35
|
+
mailNickname: this.generateMailNickname(args.options.name),
|
|
25
36
|
partsToClone: args.options.partsToClone
|
|
26
37
|
};
|
|
27
38
|
if (args.options.description) {
|
|
@@ -34,7 +45,7 @@ class TeamsTeamCloneCommand extends GraphCommand_1.default {
|
|
|
34
45
|
data.visibility = args.options.visibility;
|
|
35
46
|
}
|
|
36
47
|
const requestOptions = {
|
|
37
|
-
url: `${this.resource}/v1.0/teams/${encodeURIComponent(args.options.
|
|
48
|
+
url: `${this.resource}/v1.0/teams/${encodeURIComponent(args.options.id)}/clone`,
|
|
38
49
|
headers: {
|
|
39
50
|
"content-type": "application/json",
|
|
40
51
|
accept: 'application/json;odata.metadata=none'
|
|
@@ -46,13 +57,25 @@ class TeamsTeamCloneCommand extends GraphCommand_1.default {
|
|
|
46
57
|
.post(requestOptions)
|
|
47
58
|
.then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
48
59
|
}
|
|
60
|
+
optionSets() {
|
|
61
|
+
return [
|
|
62
|
+
['id', 'teamId'],
|
|
63
|
+
['name', 'displayName']
|
|
64
|
+
];
|
|
65
|
+
}
|
|
49
66
|
options() {
|
|
50
67
|
const options = [
|
|
51
68
|
{
|
|
52
|
-
option: '-i, --
|
|
69
|
+
option: '-i, --id [teamId]'
|
|
53
70
|
},
|
|
54
71
|
{
|
|
55
|
-
option: '
|
|
72
|
+
option: '--teamId [teamId]'
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
option: '-n, --name [name]'
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
option: '--displayName [displayName]'
|
|
56
79
|
},
|
|
57
80
|
{
|
|
58
81
|
option: '-p, --partsToClone <partsToClone>',
|
|
@@ -73,9 +96,12 @@ class TeamsTeamCloneCommand extends GraphCommand_1.default {
|
|
|
73
96
|
return options.concat(parentOptions);
|
|
74
97
|
}
|
|
75
98
|
validate(args) {
|
|
76
|
-
if (!utils_1.validation.isValidGuid(args.options.teamId)) {
|
|
99
|
+
if (args.options.teamId && !utils_1.validation.isValidGuid(args.options.teamId)) {
|
|
77
100
|
return `${args.options.teamId} is not a valid GUID`;
|
|
78
101
|
}
|
|
102
|
+
if (args.options.id && !utils_1.validation.isValidGuid(args.options.id)) {
|
|
103
|
+
return `${args.options.id} is not a valid GUID`;
|
|
104
|
+
}
|
|
79
105
|
const partsToClone = args.options.partsToClone.replace(/\s/g, '').split(',');
|
|
80
106
|
for (const partToClone of partsToClone) {
|
|
81
107
|
const part = partToClone.toLowerCase();
|
|
@@ -20,8 +20,8 @@ class TeamsTeamSetCommand extends GraphCommand_1.default {
|
|
|
20
20
|
}
|
|
21
21
|
mapRequestBody(options) {
|
|
22
22
|
const requestBody = {};
|
|
23
|
-
if (options.
|
|
24
|
-
requestBody.displayName = options.
|
|
23
|
+
if (options.name) {
|
|
24
|
+
requestBody.displayName = options.name;
|
|
25
25
|
}
|
|
26
26
|
if (options.description) {
|
|
27
27
|
requestBody.description = options.description;
|
|
@@ -38,9 +38,17 @@ class TeamsTeamSetCommand extends GraphCommand_1.default {
|
|
|
38
38
|
return requestBody;
|
|
39
39
|
}
|
|
40
40
|
commandAction(logger, args, cb) {
|
|
41
|
+
if (args.options.teamId) {
|
|
42
|
+
args.options.id = args.options.teamId;
|
|
43
|
+
this.warn(logger, `Option 'teamId' is deprecated. Please use 'id' instead.`);
|
|
44
|
+
}
|
|
45
|
+
if (args.options.displayName) {
|
|
46
|
+
args.options.name = args.options.displayName;
|
|
47
|
+
this.warn(logger, `Option 'displayName' is deprecated. Please use 'name' instead.`);
|
|
48
|
+
}
|
|
41
49
|
const data = this.mapRequestBody(args.options);
|
|
42
50
|
const requestOptions = {
|
|
43
|
-
url: `${this.resource}/v1.0/groups/${encodeURIComponent(args.options.
|
|
51
|
+
url: `${this.resource}/v1.0/groups/${encodeURIComponent(args.options.id)}`,
|
|
44
52
|
headers: {
|
|
45
53
|
accept: 'application/json;odata.metadata=none'
|
|
46
54
|
},
|
|
@@ -51,10 +59,19 @@ class TeamsTeamSetCommand extends GraphCommand_1.default {
|
|
|
51
59
|
.patch(requestOptions)
|
|
52
60
|
.then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
53
61
|
}
|
|
62
|
+
optionSets() {
|
|
63
|
+
return [['id', 'teamId']];
|
|
64
|
+
}
|
|
54
65
|
options() {
|
|
55
66
|
const options = [
|
|
56
67
|
{
|
|
57
|
-
option: '-i, --
|
|
68
|
+
option: '-i, --id [id]'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
option: '--teamId [teamId]'
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
option: '-n, --name [name]'
|
|
58
75
|
},
|
|
59
76
|
{
|
|
60
77
|
option: '--displayName [displayName]'
|
|
@@ -77,9 +94,12 @@ class TeamsTeamSetCommand extends GraphCommand_1.default {
|
|
|
77
94
|
return options.concat(parentOptions);
|
|
78
95
|
}
|
|
79
96
|
validate(args) {
|
|
80
|
-
if (!utils_1.validation.isValidGuid(args.options.teamId)) {
|
|
97
|
+
if (args.options.teamId && !utils_1.validation.isValidGuid(args.options.teamId)) {
|
|
81
98
|
return `${args.options.teamId} is not a valid GUID`;
|
|
82
99
|
}
|
|
100
|
+
if (args.options.id && !utils_1.validation.isValidGuid(args.options.id)) {
|
|
101
|
+
return `${args.options.id} is not a valid GUID`;
|
|
102
|
+
}
|
|
83
103
|
if (args.options.visibility) {
|
|
84
104
|
if (args.options.visibility.toLowerCase() !== 'private' && args.options.visibility.toLowerCase() !== 'public') {
|
|
85
105
|
return `${args.options.visibility} is not a valid visibility type. Allowed values are Private|Public`;
|
|
@@ -23,10 +23,13 @@ m365 spo field get [options]
|
|
|
23
23
|
: Server- or web-relative URL of the list where the field is located. Specify only one of listTitle, listId or listUrl
|
|
24
24
|
|
|
25
25
|
`-i, --id [id]`
|
|
26
|
-
: The ID of the field to retrieve. Specify id or
|
|
26
|
+
: The ID of the field to retrieve. Specify id or title but not both
|
|
27
27
|
|
|
28
28
|
`--fieldTitle [fieldTitle]`
|
|
29
|
-
: The display name (case-sensitive) of the field to retrieve. Specify id or fieldTitle but not both
|
|
29
|
+
: (deprecated. Use `title` instead) The display name (case-sensitive) of the field to retrieve. Specify id or fieldTitle but not both
|
|
30
|
+
|
|
31
|
+
`-t, --title [title]`
|
|
32
|
+
: The display name (case-sensitive) of the field to remove. Specify id or title, or group but not both
|
|
30
33
|
|
|
31
34
|
--8<-- "docs/cmd/_global.md"
|
|
32
35
|
|
|
@@ -47,5 +50,5 @@ m365 spo field get --webUrl https://contoso.sharepoint.com/sites/contoso-sales -
|
|
|
47
50
|
Retrieves list column by display name located in site _https://contoso.sharepoint.com/sites/contoso-sales_. Retrieves the list by its url
|
|
48
51
|
|
|
49
52
|
```sh
|
|
50
|
-
m365 spo field get --webUrl https://contoso.sharepoint.com/sites/contoso-sales --listUrl
|
|
53
|
+
m365 spo field get --webUrl https://contoso.sharepoint.com/sites/contoso-sales --listUrl "Lists/Events" --title "Title"
|
|
51
54
|
```
|
|
@@ -23,13 +23,16 @@ m365 spo field remove [options]
|
|
|
23
23
|
: Server- or web-relative URL of the list where the field is located. Specify only one of `listTitle`, `listId` or `listUrl`
|
|
24
24
|
|
|
25
25
|
`-i, --id [id]`
|
|
26
|
-
: The ID of the field to remove. Specify id,
|
|
26
|
+
: The ID of the field to remove. Specify id, title, or group
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
: The display name (case-sensitive) of the field to remove. Specify id, fieldTitle, or group
|
|
28
|
+
`--fieldTitle [fieldTitle]`
|
|
29
|
+
: (deprecated. Use `title` instead) The display name (case-sensitive) of the field to remove. Specify id, fieldTitle, or group
|
|
30
|
+
|
|
31
|
+
`-t, --title [title]`
|
|
32
|
+
: The display name (case-sensitive) of the field to remove. Specify id, title, or group
|
|
30
33
|
|
|
31
34
|
`-g, --group [group]`
|
|
32
|
-
: Delete all fields from this group (case-sensitive). Specify id,
|
|
35
|
+
: Delete all fields from this group (case-sensitive). Specify id, title, or group
|
|
33
36
|
|
|
34
37
|
`--confirm`
|
|
35
38
|
: Don't prompt for confirming removing the field
|
|
@@ -53,11 +56,11 @@ m365 spo field remove --webUrl https://contoso.sharepoint.com/sites/contoso-sale
|
|
|
53
56
|
Remove the list column with the specified display name, located in site _https://contoso.sharepoint.com/sites/contoso-sales_. Retrieves the list by its url
|
|
54
57
|
|
|
55
58
|
```sh
|
|
56
|
-
m365 spo field remove --webUrl https://contoso.sharepoint.com/sites/contoso-sales --listUrl
|
|
59
|
+
m365 spo field remove --webUrl https://contoso.sharepoint.com/sites/contoso-sales --listUrl "Lists/Events" --title "Title"
|
|
57
60
|
```
|
|
58
61
|
|
|
59
62
|
Remove all site columns from group _MyGroup_
|
|
60
63
|
|
|
61
64
|
```sh
|
|
62
|
-
m365 spo field remove --webUrl https://contoso.sharepoint.com/sites/contoso-sales --group
|
|
65
|
+
m365 spo field remove --webUrl https://contoso.sharepoint.com/sites/contoso-sales --group "MyGroup"
|
|
63
66
|
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# spo file rename
|
|
2
|
+
|
|
3
|
+
Renames a file
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
m365 spo file rename [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
`-u, --webUrl <webUrl>`
|
|
14
|
+
: The URL of the site where the file is located
|
|
15
|
+
|
|
16
|
+
`-s, --sourceUrl <sourceUrl>`
|
|
17
|
+
: Site-relative URL of the file to rename
|
|
18
|
+
|
|
19
|
+
`-t, --targetFileName <targetFileName>`
|
|
20
|
+
: New file name of the file
|
|
21
|
+
|
|
22
|
+
`--force`
|
|
23
|
+
: If a file already exists with target file name, it will be moved to the recycle bin. If omitted, the rename operation will be canceled if a file already exists with the specified file name
|
|
24
|
+
|
|
25
|
+
--8<-- "docs/cmd/_global.md"
|
|
26
|
+
|
|
27
|
+
## Remarks
|
|
28
|
+
|
|
29
|
+
If you try to rename a file without the `--force` flag and a file with this name already exists, the operation will be cancelled.
|
|
30
|
+
|
|
31
|
+
## Examples
|
|
32
|
+
|
|
33
|
+
Renames a file with server-relative URL _/Shared Documents/Test1.docx_ located in site _<https://contoso.sharepoint.com/sites/project-x>_ to _Test2.docx_
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
m365 spo file rename --webUrl https://contoso.sharepoint.com/sites/project-x --sourceUrl '/Shared Documents/Test1.docx' --targetFileName 'Test2.docx'
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Renames a file with server-relative URL _/Shared Documents/Test1.docx_ located in site _<https://contoso.sharepoint.com/sites/project-x>_ to _Test2.docx_. If the file with the target file name already exists, this file will be moved to the recycle bin
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
m365 spo file rename --webUrl https://contoso.sharepoint.com/sites/project-x --sourceUrl '/Shared Documents/Test1.docx' --targetFileName 'Test2.docx' --force
|
|
43
|
+
```
|
|
@@ -11,13 +11,16 @@ m365 spo group get [options]
|
|
|
11
11
|
## Options
|
|
12
12
|
|
|
13
13
|
`-u, --webUrl <webUrl>`
|
|
14
|
-
: URL of the site where the group is located
|
|
14
|
+
: URL of the site where the group is located.
|
|
15
15
|
|
|
16
16
|
`-i, --id [id]`
|
|
17
|
-
: ID of the site group to get. Use either `id` or `
|
|
17
|
+
: ID of the site group to get. Use either `id`, `name` or `associatedGroup` but not multiple.
|
|
18
18
|
|
|
19
19
|
`--name [name]`
|
|
20
|
-
: Name of the site group to get.
|
|
20
|
+
: Name of the site group to get. Use either `id`, `name` or `associatedGroup` but not multiple.
|
|
21
|
+
|
|
22
|
+
`--associatedGroup [associatedGroup]`
|
|
23
|
+
: Type of the associated group to get. Available values: `Owner`, `Member`, `Visitor`. Use either `id`, `name` or `associatedGroup` but not multiple.
|
|
21
24
|
|
|
22
25
|
--8<-- "docs/cmd/_global.md"
|
|
23
26
|
|
|
@@ -34,3 +37,9 @@ Get group with name _Team Site Members_ for web _https://contoso.sharepoint.com/
|
|
|
34
37
|
```sh
|
|
35
38
|
m365 spo group get --webUrl https://contoso.sharepoint.com/sites/project-x --name "Team Site Members"
|
|
36
39
|
```
|
|
40
|
+
|
|
41
|
+
Get the associated owner group of a specified site
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
m365 spo group get --webUrl https://contoso.sharepoint.com/sites/project-x --associatedGroup Owner
|
|
45
|
+
```
|
|
@@ -14,7 +14,7 @@ m365 spo site apppermission add [options]
|
|
|
14
14
|
: URL of the site collection to add the permission
|
|
15
15
|
|
|
16
16
|
`-p, --permission <permission>`
|
|
17
|
-
: Permission to site (`read`, `write`, `
|
|
17
|
+
: Permission to site (`read`, `write`, or `owner`)
|
|
18
18
|
|
|
19
19
|
`-i, --appId [appId]`
|
|
20
20
|
: Client ID of the Azure AD app for which to grant permissions
|
|
@@ -23,7 +23,7 @@ m365 spo site apppermission set [options]
|
|
|
23
23
|
: Display name of the Azure AD app for which to update permissions. Specify `permissionId`, `appId` or `appDisplayName`
|
|
24
24
|
|
|
25
25
|
`-p, --permission <permission>`
|
|
26
|
-
: Permission to site (`read`, `write`, `
|
|
26
|
+
: Permission to site (`read`, `write`, or `owner`)
|
|
27
27
|
|
|
28
28
|
--8<-- "docs/cmd/_global.md"
|
|
29
29
|
|
|
@@ -22,10 +22,10 @@ m365 teams tab get [options]
|
|
|
22
22
|
`--channelName [channelName]`
|
|
23
23
|
: The display name of the Microsoft Teams channel where the tab is located. Specify either channelId or channelName but not both
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
`-i, --tabId [tabId]`
|
|
26
26
|
: The ID of the Microsoft Teams tab. Specify either tabId or tabName but not both
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
`-n, --tabName [tabName]`
|
|
29
29
|
: The display name of the Microsoft Teams tab. Specify either tabId or tabName but not both
|
|
30
30
|
|
|
31
31
|
--8<-- "docs/cmd/_global.md"
|
|
@@ -10,11 +10,17 @@ m365 teams team clone [options]
|
|
|
10
10
|
|
|
11
11
|
## Options
|
|
12
12
|
|
|
13
|
-
`-i, --
|
|
13
|
+
`-i, --id [id]`
|
|
14
14
|
: The ID of the Microsoft Teams team to clone
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
: The
|
|
16
|
+
`--teamId [teamId]`
|
|
17
|
+
: (deprecated. Use `id` instead) The ID of the Microsoft Teams team to clone
|
|
18
|
+
|
|
19
|
+
`-n, --name [name]`
|
|
20
|
+
: The display name for the new Microsoft Teams Team to clone
|
|
21
|
+
|
|
22
|
+
`--displayName [displayName]`
|
|
23
|
+
: (deprecated. Use `name` instead) The display name for the new Microsoft Teams Team to clone
|
|
18
24
|
|
|
19
25
|
`-p, --partsToClone <partsToClone>`
|
|
20
26
|
: A comma-separated list of the parts to clone. Allowed values are `apps,channels,members,settings,tabs`
|
|
@@ -41,11 +47,11 @@ When tabs are cloned, they are put into an unconfigured state. The first time yo
|
|
|
41
47
|
Creates a clone of a Microsoft Teams team with mandatory parameters
|
|
42
48
|
|
|
43
49
|
```sh
|
|
44
|
-
m365 teams team clone --
|
|
50
|
+
m365 teams team clone --id 15d7a78e-fd77-4599-97a5-dbb6372846c5 --name "Library Assist" --partsToClone "apps,tabs,settings,channels,members"
|
|
45
51
|
```
|
|
46
52
|
|
|
47
53
|
Creates a clone of a Microsoft Teams team with mandatory and optional parameters
|
|
48
54
|
|
|
49
55
|
```sh
|
|
50
|
-
m365 teams team clone --
|
|
56
|
+
m365 teams team clone --id 15d7a78e-fd77-4599-97a5-dbb6372846c5 --name "Library Assist" --partsToClone "apps,tabs,settings,channels,members" --description "Self help community for library" --classification "Library" --visibility "public"
|
|
51
57
|
```
|
|
@@ -10,11 +10,17 @@ m365 teams team set [options]
|
|
|
10
10
|
|
|
11
11
|
## Options
|
|
12
12
|
|
|
13
|
-
`-i, --
|
|
13
|
+
`-i, --id [id]`
|
|
14
14
|
: The ID of the Microsoft Teams team for which to update settings
|
|
15
15
|
|
|
16
|
+
`--teamId [teamId]`
|
|
17
|
+
: (deprecated. Use `id` instead) The ID of the Microsoft Teams team for which to update settings
|
|
18
|
+
|
|
19
|
+
`-n, --name [name]`
|
|
20
|
+
: The display name for the Microsoft Teams team for which to update settings
|
|
21
|
+
|
|
16
22
|
`--displayName [displayName]`
|
|
17
|
-
: The display name for the Microsoft Teams team
|
|
23
|
+
: (deprecated. Use `name` instead) The display name for the Microsoft Teams team for which to update settings
|
|
18
24
|
|
|
19
25
|
`--description [description]`
|
|
20
26
|
: The description for the Microsoft Teams team
|
|
@@ -35,11 +41,11 @@ m365 teams team set [options]
|
|
|
35
41
|
Set Microsoft Teams team visibility as Private
|
|
36
42
|
|
|
37
43
|
```sh
|
|
38
|
-
m365 teams team set --
|
|
44
|
+
m365 teams team set --id "00000000-0000-0000-0000-000000000000" --visibility Private
|
|
39
45
|
```
|
|
40
46
|
|
|
41
47
|
Set Microsoft Teams team classification as MBI
|
|
42
48
|
|
|
43
49
|
```sh
|
|
44
|
-
m365 teams team set --
|
|
50
|
+
m365 teams team set --id "00000000-0000-0000-0000-000000000000" --classification MBI
|
|
45
51
|
```
|
package/package.json
CHANGED