@pnp/cli-microsoft365 6.3.0 → 6.4.0-beta.6b65014
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/.eslintrc.js +1 -0
- package/dist/Command.js +1 -0
- package/dist/m365/aad/commands/user/user-license-remove.js +2 -1
- package/dist/m365/aad/commands/user/user-recyclebinitem-restore.js +2 -9
- package/dist/m365/flow/commands/flow-disable.js +9 -2
- package/dist/m365/flow/commands/flow-enable.js +9 -2
- package/dist/m365/flow/commands/flow-get.js +9 -2
- package/dist/m365/flow/commands/flow-list.js +1 -1
- package/dist/m365/flow/commands/flow-remove.js +2 -2
- package/dist/m365/flow/commands/owner/owner-add.js +147 -0
- package/dist/m365/flow/commands/owner/owner-list.js +89 -0
- package/dist/m365/flow/commands/owner/owner-remove.js +147 -0
- package/dist/m365/flow/commands/run/run-cancel.js +9 -2
- package/dist/m365/flow/commands/run/run-list.js +5 -2
- package/dist/m365/flow/commands.js +3 -0
- package/dist/m365/planner/commands/roster/roster-member-get.js +98 -0
- package/dist/m365/planner/commands.js +1 -0
- package/dist/m365/spo/commands/customaction/customaction-get.js +27 -7
- package/dist/m365/spo/commands/file/file-move.js +1 -1
- package/dist/m365/spo/commands/list/list-add.js +11 -8
- package/dist/m365/spo/commands/list/list-set.js +3 -3
- package/dist/m365/spo/commands/term/term-get.js +68 -48
- package/dist/utils/aadGroup.js +18 -0
- package/docs/docs/cmd/aad/approleassignment/approleassignment-add.md +5 -5
- package/docs/docs/cmd/aad/approleassignment/approleassignment-remove.md +3 -3
- package/docs/docs/cmd/aad/user/user-remove.md +1 -1
- package/docs/docs/cmd/flow/owner/owner-add.md +61 -0
- package/docs/docs/cmd/flow/owner/owner-list.md +90 -0
- package/docs/docs/cmd/flow/owner/owner-remove.md +67 -0
- package/docs/docs/cmd/flow/run/run-list.md +28 -0
- package/docs/docs/cmd/planner/roster/roster-member-get.md +87 -0
- package/docs/docs/cmd/spo/customaction/customaction-get.md +113 -11
- package/docs/docs/cmd/spo/group/group-member-add.md +4 -4
- package/docs/docs/cmd/spo/list/list-add.md +2 -2
- package/docs/docs/cmd/spo/list/list-set.md +2 -2
- package/docs/docs/cmd/spo/navigation/navigation-node-add.md +1 -1
- package/docs/docs/cmd/spo/navigation/navigation-node-set.md +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-settings-set.md +26 -26
- package/docs/docs/cmd/teams/channel/channel-member-add.md +2 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
+
};
|
|
16
|
+
var _PlannerRosterMemberGetCommand_instances, _PlannerRosterMemberGetCommand_initTelemetry, _PlannerRosterMemberGetCommand_initOptions, _PlannerRosterMemberGetCommand_initOptionSets, _PlannerRosterMemberGetCommand_initValidators;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const request_1 = require("../../../../request");
|
|
19
|
+
const validation_1 = require("../../../../utils/validation");
|
|
20
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
21
|
+
const commands_1 = require("../../commands");
|
|
22
|
+
const aadUser_1 = require("../../../../utils/aadUser");
|
|
23
|
+
class PlannerRosterMemberGetCommand extends GraphCommand_1.default {
|
|
24
|
+
get name() {
|
|
25
|
+
return commands_1.default.ROSTER_MEMBER_GET;
|
|
26
|
+
}
|
|
27
|
+
get description() {
|
|
28
|
+
return 'Gets a member of the specified Microsoft Planner Roster';
|
|
29
|
+
}
|
|
30
|
+
constructor() {
|
|
31
|
+
super();
|
|
32
|
+
_PlannerRosterMemberGetCommand_instances.add(this);
|
|
33
|
+
__classPrivateFieldGet(this, _PlannerRosterMemberGetCommand_instances, "m", _PlannerRosterMemberGetCommand_initTelemetry).call(this);
|
|
34
|
+
__classPrivateFieldGet(this, _PlannerRosterMemberGetCommand_instances, "m", _PlannerRosterMemberGetCommand_initOptions).call(this);
|
|
35
|
+
__classPrivateFieldGet(this, _PlannerRosterMemberGetCommand_instances, "m", _PlannerRosterMemberGetCommand_initValidators).call(this);
|
|
36
|
+
__classPrivateFieldGet(this, _PlannerRosterMemberGetCommand_instances, "m", _PlannerRosterMemberGetCommand_initOptionSets).call(this);
|
|
37
|
+
}
|
|
38
|
+
commandAction(logger, args) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
if (this.verbose) {
|
|
41
|
+
logger.logToStderr(`Retrieving member ${args.options.userName || args.options.userId} from the Microsoft Planner Roster`);
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
const userId = yield this.getUserId(args);
|
|
45
|
+
const requestOptions = {
|
|
46
|
+
url: `${this.resource}/beta/planner/rosters/${args.options.rosterId}/members/${userId}`,
|
|
47
|
+
headers: {
|
|
48
|
+
accept: 'application/json;odata.metadata=none'
|
|
49
|
+
},
|
|
50
|
+
responseType: 'json'
|
|
51
|
+
};
|
|
52
|
+
const response = yield request_1.default.get(requestOptions);
|
|
53
|
+
logger.log(response);
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
this.handleRejectedODataJsonPromise(err);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
getUserId(args) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
if (args.options.userId) {
|
|
63
|
+
return args.options.userId;
|
|
64
|
+
}
|
|
65
|
+
return aadUser_1.aadUser.getUserIdByUpn(args.options.userName);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
_PlannerRosterMemberGetCommand_instances = new WeakSet(), _PlannerRosterMemberGetCommand_initTelemetry = function _PlannerRosterMemberGetCommand_initTelemetry() {
|
|
70
|
+
this.telemetry.push((args) => {
|
|
71
|
+
Object.assign(this.telemetryProperties, {
|
|
72
|
+
userId: typeof args.options.userId !== 'undefined',
|
|
73
|
+
userName: typeof args.options.userName !== 'undefined'
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}, _PlannerRosterMemberGetCommand_initOptions = function _PlannerRosterMemberGetCommand_initOptions() {
|
|
77
|
+
this.options.unshift({
|
|
78
|
+
option: '--rosterId <rosterId>'
|
|
79
|
+
}, {
|
|
80
|
+
option: '--userId [userId]'
|
|
81
|
+
}, {
|
|
82
|
+
option: '--userName [userName]'
|
|
83
|
+
});
|
|
84
|
+
}, _PlannerRosterMemberGetCommand_initOptionSets = function _PlannerRosterMemberGetCommand_initOptionSets() {
|
|
85
|
+
this.optionSets.push({ options: ['userId', 'userName'] });
|
|
86
|
+
}, _PlannerRosterMemberGetCommand_initValidators = function _PlannerRosterMemberGetCommand_initValidators() {
|
|
87
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
if (args.options.userId && !validation_1.validation.isValidGuid(args.options.userId)) {
|
|
89
|
+
return `${args.options.userId} is not a valid GUID`;
|
|
90
|
+
}
|
|
91
|
+
if (args.options.userName && !validation_1.validation.isValidUserPrincipalName(args.options.userName)) {
|
|
92
|
+
return `${args.options.userName} is not a valid userName`;
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
}));
|
|
96
|
+
};
|
|
97
|
+
module.exports = new PlannerRosterMemberGetCommand();
|
|
98
|
+
//# sourceMappingURL=roster-member-get.js.map
|
|
@@ -15,6 +15,7 @@ exports.default = {
|
|
|
15
15
|
ROSTER_ADD: `${prefix} roster add`,
|
|
16
16
|
ROSTER_GET: `${prefix} roster get`,
|
|
17
17
|
ROSTER_MEMBER_ADD: `${prefix} roster member add`,
|
|
18
|
+
ROSTER_MEMBER_GET: `${prefix} roster member get`,
|
|
18
19
|
ROSTER_MEMBER_LIST: `${prefix} roster member list`,
|
|
19
20
|
ROSTER_MEMBER_REMOVE: `${prefix} roster member remove`,
|
|
20
21
|
ROSTER_REMOVE: `${prefix} roster remove`,
|
|
@@ -77,14 +77,26 @@ class SpoCustomActionGetCommand extends SpoCommand_1.default {
|
|
|
77
77
|
}
|
|
78
78
|
return customAction;
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
else if (options.title) {
|
|
81
|
+
const customActions = yield spo_1.spo.getCustomActions(options.webUrl, options.scope, `Title eq '${formatting_1.formatting.encodeQueryParameter(options.title)}'`);
|
|
82
|
+
if (customActions.length === 1) {
|
|
83
|
+
return customActions[0];
|
|
84
|
+
}
|
|
85
|
+
if (customActions.length === 0) {
|
|
86
|
+
throw `No user custom action with title '${options.title}' found`;
|
|
87
|
+
}
|
|
88
|
+
throw `Multiple user custom actions with title '${options.title}' found. Please disambiguate using IDs: ${customActions.map(a => a.Id).join(', ')}`;
|
|
83
89
|
}
|
|
84
|
-
|
|
85
|
-
|
|
90
|
+
else {
|
|
91
|
+
const customActions = yield spo_1.spo.getCustomActions(options.webUrl, options.scope, `ClientSideComponentId eq guid'${options.clientSideComponentId}'`);
|
|
92
|
+
if (customActions.length === 0) {
|
|
93
|
+
throw `No user custom action with ClientSideComponentId '${options.clientSideComponentId}' found`;
|
|
94
|
+
}
|
|
95
|
+
if (customActions.length > 1) {
|
|
96
|
+
throw `Multiple user custom actions with ClientSideComponentId '${options.clientSideComponentId}' found. Please disambiguate using IDs: ${customActions.map((customAction) => customAction.Id).join(', ')}`;
|
|
97
|
+
}
|
|
98
|
+
return customActions[0];
|
|
86
99
|
}
|
|
87
|
-
throw `Multiple user custom actions with title '${options.title}' found. Please disambiguate using IDs: ${customActions.map(a => a.Id).join(', ')}`;
|
|
88
100
|
});
|
|
89
101
|
}
|
|
90
102
|
humanizeScope(scope) {
|
|
@@ -100,6 +112,9 @@ class SpoCustomActionGetCommand extends SpoCommand_1.default {
|
|
|
100
112
|
_SpoCustomActionGetCommand_instances = new WeakSet(), _SpoCustomActionGetCommand_initTelemetry = function _SpoCustomActionGetCommand_initTelemetry() {
|
|
101
113
|
this.telemetry.push((args) => {
|
|
102
114
|
Object.assign(this.telemetryProperties, {
|
|
115
|
+
id: typeof args.options.id !== 'undefined',
|
|
116
|
+
title: typeof args.options.title !== 'undefined',
|
|
117
|
+
clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
|
|
103
118
|
scope: args.options.scope || 'All'
|
|
104
119
|
});
|
|
105
120
|
});
|
|
@@ -108,6 +123,8 @@ _SpoCustomActionGetCommand_instances = new WeakSet(), _SpoCustomActionGetCommand
|
|
|
108
123
|
option: '-i, --id [id]'
|
|
109
124
|
}, {
|
|
110
125
|
option: '-t, --title [title]'
|
|
126
|
+
}, {
|
|
127
|
+
option: '-c, --clientSideComponentId [clientSideComponentId]'
|
|
111
128
|
}, {
|
|
112
129
|
option: '-u, --webUrl <webUrl>'
|
|
113
130
|
}, {
|
|
@@ -130,10 +147,13 @@ _SpoCustomActionGetCommand_instances = new WeakSet(), _SpoCustomActionGetCommand
|
|
|
130
147
|
return `${args.options.scope} is not a valid custom action scope. Allowed values are Site|Web|All`;
|
|
131
148
|
}
|
|
132
149
|
}
|
|
150
|
+
if (args.options.clientSideComponentId && validation_1.validation.isValidGuid(args.options.clientSideComponentId) === false) {
|
|
151
|
+
return `${args.options.clientSideComponentId} is not a valid GUID.`;
|
|
152
|
+
}
|
|
133
153
|
return true;
|
|
134
154
|
}));
|
|
135
155
|
}, _SpoCustomActionGetCommand_initOptionSets = function _SpoCustomActionGetCommand_initOptionSets() {
|
|
136
|
-
this.optionSets.push({ options: ['id', 'title'] });
|
|
156
|
+
this.optionSets.push({ options: ['id', 'title', 'clientSideComponentId'] });
|
|
137
157
|
};
|
|
138
158
|
module.exports = new SpoCustomActionGetCommand();
|
|
139
159
|
//# sourceMappingURL=customaction-get.js.map
|
|
@@ -55,7 +55,7 @@ class SpoFileMoveCommand extends SpoCommand_1.default {
|
|
|
55
55
|
// A user might enter folder instead of file as source url by mistake
|
|
56
56
|
// then there are edge cases when deleteIfAlreadyExists flag is set
|
|
57
57
|
// the user can receive misleading error message.
|
|
58
|
-
this.fileExists(tenantUrl, webUrl, args.options.sourceUrl);
|
|
58
|
+
yield this.fileExists(tenantUrl, webUrl, args.options.sourceUrl);
|
|
59
59
|
if (args.options.deleteIfAlreadyExists) {
|
|
60
60
|
// try delete target file, if deleteIfAlreadyExists flag is set
|
|
61
61
|
const filename = args.options.sourceUrl.replace(/^.*[\\\/]/, '');
|
|
@@ -106,7 +106,7 @@ class SpoListAddCommand extends SpoCommand_1.default {
|
|
|
106
106
|
mapRequestBody(options) {
|
|
107
107
|
const requestBody = {
|
|
108
108
|
Title: options.title,
|
|
109
|
-
BaseTemplate: ListTemplateType_1.ListTemplateType[options.baseTemplate.trim()].valueOf()
|
|
109
|
+
BaseTemplate: options.baseTemplate ? ListTemplateType_1.ListTemplateType[options.baseTemplate.trim()].valueOf() : ListTemplateType_1.ListTemplateType.GenericList
|
|
110
110
|
};
|
|
111
111
|
if (options.description) {
|
|
112
112
|
requestBody.Description = options.description;
|
|
@@ -148,7 +148,7 @@ class SpoListAddCommand extends SpoCommand_1.default {
|
|
|
148
148
|
requestBody.DisableGridEditing = options.disableGridEditing;
|
|
149
149
|
}
|
|
150
150
|
if (options.draftVersionVisibility) {
|
|
151
|
-
requestBody.DraftVersionVisibility = options.draftVersionVisibility;
|
|
151
|
+
requestBody.DraftVersionVisibility = DraftVisibilityType_1.DraftVisibilityType[options.draftVersionVisibility.trim()];
|
|
152
152
|
}
|
|
153
153
|
if (options.emailAlias) {
|
|
154
154
|
requestBody.EmailAlias = options.emailAlias;
|
|
@@ -226,7 +226,7 @@ class SpoListAddCommand extends SpoCommand_1.default {
|
|
|
226
226
|
requestBody.IsApplicationList = options.isApplicationList;
|
|
227
227
|
}
|
|
228
228
|
if (options.listExperienceOptions) {
|
|
229
|
-
requestBody.ListExperienceOptions = options.listExperienceOptions;
|
|
229
|
+
requestBody.ListExperienceOptions = ListExperience_1.ListExperience[options.listExperienceOptions.trim()];
|
|
230
230
|
}
|
|
231
231
|
if (options.majorVersionLimit) {
|
|
232
232
|
requestBody.MajorVersionLimit = options.majorVersionLimit;
|
|
@@ -296,6 +296,7 @@ _SpoListAddCommand_instances = new WeakSet(), _SpoListAddCommand_initTelemetry =
|
|
|
296
296
|
const telemetryProps = {};
|
|
297
297
|
// add properties with identifiable data
|
|
298
298
|
[
|
|
299
|
+
'baseTemplate',
|
|
299
300
|
'description',
|
|
300
301
|
'templateFeatureId',
|
|
301
302
|
'schemaXml',
|
|
@@ -342,7 +343,7 @@ _SpoListAddCommand_instances = new WeakSet(), _SpoListAddCommand_initTelemetry =
|
|
|
342
343
|
this.options.unshift({
|
|
343
344
|
option: '-t, --title <title>'
|
|
344
345
|
}, {
|
|
345
|
-
option: '--baseTemplate
|
|
346
|
+
option: '--baseTemplate [baseTemplate]',
|
|
346
347
|
autocomplete: this.listTemplateTypeMap
|
|
347
348
|
}, {
|
|
348
349
|
option: '-u, --webUrl <webUrl>'
|
|
@@ -520,9 +521,11 @@ _SpoListAddCommand_instances = new WeakSet(), _SpoListAddCommand_initTelemetry =
|
|
|
520
521
|
if (isValidSharePointUrl !== true) {
|
|
521
522
|
return isValidSharePointUrl;
|
|
522
523
|
}
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
524
|
+
if (args.options.baseTemplate) {
|
|
525
|
+
const template = ListTemplateType_1.ListTemplateType[args.options.baseTemplate.trim()];
|
|
526
|
+
if (!template) {
|
|
527
|
+
return `${args.options.baseTemplate} is not a valid baseTemplate value`;
|
|
528
|
+
}
|
|
526
529
|
}
|
|
527
530
|
if (args.options.templateFeatureId &&
|
|
528
531
|
!validation_1.validation.isValidGuid(args.options.templateFeatureId)) {
|
|
@@ -538,7 +541,7 @@ _SpoListAddCommand_instances = new WeakSet(), _SpoListAddCommand_initTelemetry =
|
|
|
538
541
|
}
|
|
539
542
|
if (args.options.draftVersionVisibility) {
|
|
540
543
|
const draftType = DraftVisibilityType_1.DraftVisibilityType[args.options.draftVersionVisibility.trim()];
|
|
541
|
-
if (
|
|
544
|
+
if (draftType === undefined) {
|
|
542
545
|
return `${args.options.draftVersionVisibility} is not a valid draftVisibilityType value`;
|
|
543
546
|
}
|
|
544
547
|
}
|
|
@@ -150,7 +150,7 @@ class SpoListSetCommand extends SpoCommand_1.default {
|
|
|
150
150
|
requestBody.DisableGridEditing = options.disableGridEditing;
|
|
151
151
|
}
|
|
152
152
|
if (options.draftVersionVisibility) {
|
|
153
|
-
requestBody.DraftVersionVisibility = options.draftVersionVisibility;
|
|
153
|
+
requestBody.DraftVersionVisibility = DraftVisibilityType_1.DraftVisibilityType[options.draftVersionVisibility.trim()];
|
|
154
154
|
}
|
|
155
155
|
if (options.emailAlias) {
|
|
156
156
|
requestBody.EmailAlias = options.emailAlias;
|
|
@@ -228,7 +228,7 @@ class SpoListSetCommand extends SpoCommand_1.default {
|
|
|
228
228
|
requestBody.IsApplicationList = options.isApplicationList;
|
|
229
229
|
}
|
|
230
230
|
if (options.listExperienceOptions) {
|
|
231
|
-
requestBody.ListExperienceOptions = options.listExperienceOptions;
|
|
231
|
+
requestBody.ListExperienceOptions = ListExperience_1.ListExperience[options.listExperienceOptions.trim()];
|
|
232
232
|
}
|
|
233
233
|
if (options.majorVersionLimit) {
|
|
234
234
|
requestBody.MajorVersionLimit = options.majorVersionLimit;
|
|
@@ -545,7 +545,7 @@ _SpoListSetCommand_instances = new WeakSet(), _SpoListSetCommand_initTelemetry =
|
|
|
545
545
|
}
|
|
546
546
|
if (args.options.draftVersionVisibility) {
|
|
547
547
|
const draftType = DraftVisibilityType_1.DraftVisibilityType[args.options.draftVersionVisibility.trim()];
|
|
548
|
-
if (
|
|
548
|
+
if (draftType === undefined) {
|
|
549
549
|
return `${args.options.draftVersionVisibility} is not a valid draftVisibilityType value`;
|
|
550
550
|
}
|
|
551
551
|
}
|
|
@@ -22,6 +22,7 @@ const spo_1 = require("../../../../utils/spo");
|
|
|
22
22
|
const validation_1 = require("../../../../utils/validation");
|
|
23
23
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
24
24
|
const commands_1 = require("../../commands");
|
|
25
|
+
const os = require("os");
|
|
25
26
|
class SpoTermGetCommand extends SpoCommand_1.default {
|
|
26
27
|
get name() {
|
|
27
28
|
return commands_1.default.TERM_GET;
|
|
@@ -50,32 +51,34 @@ class SpoTermGetCommand extends SpoCommand_1.default {
|
|
|
50
51
|
data = `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="14" ObjectPathId="13" /><ObjectIdentityQuery Id="15" ObjectPathId="13" /><Query Id="16" ObjectPathId="13"><Query SelectAllProperties="true"><Properties /></Query></Query></Actions><ObjectPaths><StaticMethod Id="6" Name="GetTaxonomySession" TypeId="{981cbc68-9edc-4f8d-872f-71146fcbb84f}" /><Method Id="7" ParentId="6" Name="GetDefaultSiteCollectionTermStore" /><Method Id="13" ParentId="7" Name="GetTerm"><Parameters><Parameter Type="Guid">{${args.options.id}}</Parameter></Parameters></Method></ObjectPaths></Request>`;
|
|
51
52
|
}
|
|
52
53
|
else {
|
|
53
|
-
|
|
54
|
-
const termSetQuery = args.options.termSetId ? `<Method Id="103" ParentId="101" Name="GetById"><Parameters><Parameter Type="Guid">{${args.options.termSetId}}</Parameter></Parameters></Method>` : `<Method Id="103" ParentId="101" Name="GetByName"><Parameters><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.termSetName)}</Parameter></Parameters></Method>`;
|
|
55
|
-
data = `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="91" ObjectPathId="90" /><ObjectIdentityQuery Id="92" ObjectPathId="90" /><ObjectPath Id="94" ObjectPathId="93" /><ObjectIdentityQuery Id="95" ObjectPathId="93" /><ObjectPath Id="97" ObjectPathId="96" /><ObjectPath Id="99" ObjectPathId="98" /><ObjectIdentityQuery Id="100" ObjectPathId="98" /><ObjectPath Id="102" ObjectPathId="101" /><ObjectPath Id="104" ObjectPathId="103" /><ObjectIdentityQuery Id="105" ObjectPathId="103" /><ObjectPath Id="107" ObjectPathId="106" /><ObjectPath Id="109" ObjectPathId="108" /><ObjectIdentityQuery Id="110" ObjectPathId="108" /><Query Id="111" ObjectPathId="108"><Query SelectAllProperties="true"><Properties /></Query></Query></Actions><ObjectPaths><StaticMethod Id="90" Name="GetTaxonomySession" TypeId="{981cbc68-9edc-4f8d-872f-71146fcbb84f}" /><Method Id="93" ParentId="90" Name="GetDefaultSiteCollectionTermStore" /><Property Id="96" ParentId="93" Name="Groups" />${termGroupQuery}<Property Id="101" ParentId="98" Name="TermSets" />${termSetQuery}<Property Id="106" ParentId="103" Name="Terms" /><Method Id="108" ParentId="106" Name="GetByName"><Parameters><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.name)}</Parameter></Parameters></Method></ObjectPaths></Request>`;
|
|
54
|
+
data = `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="2" ObjectPathId="1" /><ObjectIdentityQuery Id="3" ObjectPathId="1" /><ObjectPath Id="5" ObjectPathId="4" /><ObjectIdentityQuery Id="6" ObjectPathId="4" /><ObjectPath Id="8" ObjectPathId="7" /><ObjectPath Id="10" ObjectPathId="9" /><ObjectIdentityQuery Id="11" ObjectPathId="9" /><ObjectPath Id="13" ObjectPathId="12" /><ObjectPath Id="15" ObjectPathId="14" /><ObjectIdentityQuery Id="16" ObjectPathId="14" /><ObjectPath Id="18" ObjectPathId="17" /><SetProperty Id="19" ObjectPathId="17" Name="TrimUnavailable"><Parameter Type="Boolean">true</Parameter></SetProperty><SetProperty Id="20" ObjectPathId="17" Name="TermLabel"><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.name)}</Parameter></SetProperty><ObjectPath Id="22" ObjectPathId="21" /><Query Id="23" ObjectPathId="21"><Query SelectAllProperties="true"><Properties /></Query><ChildItemQuery SelectAllProperties="true"><Properties /></ChildItemQuery></Query></Actions><ObjectPaths><StaticMethod Id="1" Name="GetTaxonomySession" TypeId="{981cbc68-9edc-4f8d-872f-71146fcbb84f}" /><Method Id="4" ParentId="1" Name="GetDefaultSiteCollectionTermStore" /><Property Id="7" ParentId="4" Name="Groups" /><Method Id="9" ParentId="7" Name="${args.options.termGroupName === undefined ? "GetById" : "GetByName"}"><Parameters><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.termGroupName) || args.options.termGroupId}</Parameter></Parameters></Method><Property Id="12" ParentId="9" Name="TermSets" /><Method Id="14" ParentId="12" Name="${args.options.termSetName === undefined ? "GetById" : "GetByName"}"><Parameters><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.termSetName) || args.options.termSetId}</Parameter></Parameters></Method><Constructor Id="17" TypeId="{61a1d689-2744-4ea3-a88b-c95bee9803aa}" /><Method Id="21" ParentId="14" Name="GetTerms"><Parameters><Parameter ObjectPathId="17" /></Parameters></Method></ObjectPaths></Request>`;
|
|
56
55
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
data: data
|
|
63
|
-
};
|
|
64
|
-
const processQuery = yield request_1.default.post(requestOptions);
|
|
65
|
-
const json = JSON.parse(processQuery);
|
|
66
|
-
const response = json[0];
|
|
67
|
-
if (response.ErrorInfo) {
|
|
68
|
-
throw response.ErrorInfo.ErrorMessage;
|
|
56
|
+
let term;
|
|
57
|
+
const csomResponse = yield this.executeCsomCall(data, spoAdminUrl, res);
|
|
58
|
+
if (csomResponse === null) {
|
|
59
|
+
throw `Term with id '${args.options.id}' could not be found.`;
|
|
69
60
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
61
|
+
else if (csomResponse._Child_Items_ !== undefined) {
|
|
62
|
+
const terms = csomResponse;
|
|
63
|
+
if (terms._Child_Items_.length === 0) {
|
|
64
|
+
throw `Term with name '${args.options.name}' could not be found.`;
|
|
65
|
+
}
|
|
66
|
+
if (terms._Child_Items_.length > 1) {
|
|
67
|
+
const disambiguationText = terms._Child_Items_.map(c => {
|
|
68
|
+
return `- ${this.getTermId(c.Id)} - ${c.PathOfTerm}`;
|
|
69
|
+
}).join(os.EOL);
|
|
70
|
+
throw new Error(`Multiple terms with the specific term name found. Please disambiguate:${os.EOL}${disambiguationText}`);
|
|
71
|
+
}
|
|
72
|
+
term = terms._Child_Items_[0];
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
term = csomResponse;
|
|
73
76
|
}
|
|
74
77
|
delete term._ObjectIdentity_;
|
|
75
78
|
delete term._ObjectType_;
|
|
76
|
-
term.CreatedDate =
|
|
77
|
-
term.Id = term.Id
|
|
78
|
-
term.LastModifiedDate =
|
|
79
|
+
term.CreatedDate = this.parseTermDateToIsoString(term.CreatedDate);
|
|
80
|
+
term.Id = this.getTermId(term.Id);
|
|
81
|
+
term.LastModifiedDate = this.parseTermDateToIsoString(term.LastModifiedDate);
|
|
79
82
|
logger.log(term);
|
|
80
83
|
}
|
|
81
84
|
catch (err) {
|
|
@@ -83,6 +86,31 @@ class SpoTermGetCommand extends SpoCommand_1.default {
|
|
|
83
86
|
}
|
|
84
87
|
});
|
|
85
88
|
}
|
|
89
|
+
executeCsomCall(data, spoAdminUrl, res) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
const requestOptions = {
|
|
92
|
+
url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
93
|
+
headers: {
|
|
94
|
+
'X-RequestDigest': res.FormDigestValue
|
|
95
|
+
},
|
|
96
|
+
data: data
|
|
97
|
+
};
|
|
98
|
+
const processQuery = yield request_1.default.post(requestOptions);
|
|
99
|
+
const json = JSON.parse(processQuery);
|
|
100
|
+
const response = json[0];
|
|
101
|
+
if (response.ErrorInfo) {
|
|
102
|
+
throw response.ErrorInfo.ErrorMessage;
|
|
103
|
+
}
|
|
104
|
+
const responseObject = json[json.length - 1];
|
|
105
|
+
return responseObject;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
getTermId(termId) {
|
|
109
|
+
return termId.replace('/Guid(', '').replace(')/', '');
|
|
110
|
+
}
|
|
111
|
+
parseTermDateToIsoString(dateAsString) {
|
|
112
|
+
return new Date(Number(dateAsString.replace('/Date(', '').replace(')/', ''))).toISOString();
|
|
113
|
+
}
|
|
86
114
|
}
|
|
87
115
|
_SpoTermGetCommand_instances = new WeakSet(), _SpoTermGetCommand_initTelemetry = function _SpoTermGetCommand_initTelemetry() {
|
|
88
116
|
this.telemetry.push((args) => {
|
|
@@ -111,39 +139,31 @@ _SpoTermGetCommand_instances = new WeakSet(), _SpoTermGetCommand_initTelemetry =
|
|
|
111
139
|
});
|
|
112
140
|
}, _SpoTermGetCommand_initValidators = function _SpoTermGetCommand_initValidators() {
|
|
113
141
|
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
114
|
-
if (args.options.id) {
|
|
115
|
-
|
|
116
|
-
return `${args.options.id} is not a valid GUID`;
|
|
117
|
-
}
|
|
142
|
+
if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
|
|
143
|
+
return `${args.options.id} is not a valid GUID`;
|
|
118
144
|
}
|
|
119
|
-
if (args.options.
|
|
120
|
-
|
|
121
|
-
return 'Specify termGroupId or termGroupName';
|
|
122
|
-
}
|
|
123
|
-
if (!args.options.termSetId && !args.options.termSetName) {
|
|
124
|
-
return 'Specify termSetId or termSetName';
|
|
125
|
-
}
|
|
145
|
+
if (args.options.termGroupId && !validation_1.validation.isValidGuid(args.options.termGroupId)) {
|
|
146
|
+
return `${args.options.termGroupId} is not a valid GUID`;
|
|
126
147
|
}
|
|
127
|
-
if (args.options.
|
|
128
|
-
return
|
|
129
|
-
}
|
|
130
|
-
if (args.options.termGroupId) {
|
|
131
|
-
if (!validation_1.validation.isValidGuid(args.options.termGroupId)) {
|
|
132
|
-
return `${args.options.termGroupId} is not a valid GUID`;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (args.options.termSetId && args.options.termSetName) {
|
|
136
|
-
return 'Specify termSetId or termSetName but not both';
|
|
137
|
-
}
|
|
138
|
-
if (args.options.termSetId) {
|
|
139
|
-
if (!validation_1.validation.isValidGuid(args.options.termSetId)) {
|
|
140
|
-
return `${args.options.termSetId} is not a valid GUID`;
|
|
141
|
-
}
|
|
148
|
+
if (args.options.termSetId && !validation_1.validation.isValidGuid(args.options.termSetId)) {
|
|
149
|
+
return `${args.options.termSetId} is not a valid GUID`;
|
|
142
150
|
}
|
|
143
151
|
return true;
|
|
144
152
|
}));
|
|
145
153
|
}, _SpoTermGetCommand_initOptionSets = function _SpoTermGetCommand_initOptionSets() {
|
|
146
|
-
this.optionSets.push({
|
|
154
|
+
this.optionSets.push({
|
|
155
|
+
options: ['id', 'name']
|
|
156
|
+
}, {
|
|
157
|
+
options: ['termGroupId', 'termGroupName'],
|
|
158
|
+
runsWhen: (args) => {
|
|
159
|
+
return args.options.name !== undefined;
|
|
160
|
+
}
|
|
161
|
+
}, {
|
|
162
|
+
options: ['termSetId', 'termSetName'],
|
|
163
|
+
runsWhen: (args) => {
|
|
164
|
+
return args.options.name !== undefined;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
147
167
|
};
|
|
148
168
|
module.exports = new SpoTermGetCommand();
|
|
149
169
|
//# sourceMappingURL=term-get.js.map
|
package/dist/utils/aadGroup.js
CHANGED
|
@@ -53,6 +53,24 @@ exports.aadGroup = {
|
|
|
53
53
|
}
|
|
54
54
|
return groups[0];
|
|
55
55
|
});
|
|
56
|
+
},
|
|
57
|
+
/**
|
|
58
|
+
* Get id of a group by its display name.
|
|
59
|
+
* @param displayName Group display name.
|
|
60
|
+
* @throws Error when group was not found.
|
|
61
|
+
* @throws Error when multiple groups with the same name were found.
|
|
62
|
+
*/
|
|
63
|
+
getGroupIdByDisplayName(displayName) {
|
|
64
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
65
|
+
const groups = yield odata_1.odata.getAllItems(`${graphResource}/v1.0/groups?$filter=displayName eq '${formatting_1.formatting.encodeQueryParameter(displayName)}'&$select=id`);
|
|
66
|
+
if (!groups.length) {
|
|
67
|
+
throw Error(`The specified group '${displayName}' does not exist.`);
|
|
68
|
+
}
|
|
69
|
+
if (groups.length > 1) {
|
|
70
|
+
throw Error(`Multiple groups with name '${displayName}' found: ${groups.map(x => x.id).join(',')}.`);
|
|
71
|
+
}
|
|
72
|
+
return groups[0].id;
|
|
73
|
+
});
|
|
56
74
|
}
|
|
57
75
|
};
|
|
58
76
|
//# sourceMappingURL=aadGroup.js.map
|
|
@@ -20,10 +20,10 @@ m365 aad approleassignment add [options]
|
|
|
20
20
|
: Application name of the App Registration to which the configured scopes (app roles) should be applied
|
|
21
21
|
|
|
22
22
|
`-r, --resource <resource>`
|
|
23
|
-
: Service principal name, appId or objectId that has the scopes (roles)
|
|
23
|
+
: Service principal name, appId or objectId that has the scopes (roles) e.g. `SharePoint`.
|
|
24
24
|
|
|
25
25
|
`-s, --scope <scope>`
|
|
26
|
-
: Permissions known also as scopes and roles to grant the application with. If multiple permissions have to be granted, they have to be comma
|
|
26
|
+
: Permissions known also as scopes and roles to grant the application with. If multiple permissions have to be granted, they have to be comma-separated e.g. `Sites.Read.All,Sites.ReadWrite.all`
|
|
27
27
|
|
|
28
28
|
--8<-- "docs/cmd/_global.md"
|
|
29
29
|
|
|
@@ -33,7 +33,7 @@ This command requires tenant administrator permissions.
|
|
|
33
33
|
|
|
34
34
|
Specify either the `appId`, `appObjectId` or `appDisplayName` but not multiple. If you specify more than one option value, the command will fail with an error.
|
|
35
35
|
|
|
36
|
-
Autocomplete values for the `resource` option do not mean allowed values. The autocomplete will just suggest some known names, but that doesn't restrict you to use name of your own custom application or other application within your tenant.
|
|
36
|
+
Autocomplete values for the `resource` option do not mean allowed values. The autocomplete will just suggest some known names, but that doesn't restrict you to use the name of your own custom application or other application within your tenant.
|
|
37
37
|
|
|
38
38
|
This command can also be used to assign permissions to system or user-assigned managed identity.
|
|
39
39
|
|
|
@@ -45,13 +45,13 @@ Adds SharePoint _Sites.Read.All_ application permissions to Azure AD application
|
|
|
45
45
|
m365 aad approleassignment add --appId "57907bf8-73fa-43a6-89a5-1f603e29e451" --resource "SharePoint" --scope "Sites.Read.All"
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
Adds multiple Microsoft Graph application permissions to an Azure AD application with name
|
|
48
|
+
Adds multiple Microsoft Graph application permissions to an Azure AD application with the name _MyAppName__
|
|
49
49
|
|
|
50
50
|
```sh
|
|
51
51
|
m365 aad approleassignment add --appDisplayName "MyAppName" --resource "Microsoft Graph" --scope "Mail.Read,Mail.Send"
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
Adds Microsoft Graph _Mail.Read_ application permissions to a system
|
|
54
|
+
Adds Microsoft Graph _Mail.Read_ application permissions to a system-managed identity app with objectId _57907bf8-73fa-43a6-89a5-1f603e29e451_
|
|
55
55
|
|
|
56
56
|
```sh
|
|
57
57
|
m365 aad approleassignment add --appObjectId "57907bf8-73fa-43a6-89a5-1f603e29e451" --resource "Microsoft Graph" --scope "Mail.Read"
|
|
@@ -20,10 +20,10 @@ m365 aad approleassignment remove [options]
|
|
|
20
20
|
: Application name of the App Registration for which the configured scopes (app roles) should be deleted
|
|
21
21
|
|
|
22
22
|
`-r, --resource <resource>`
|
|
23
|
-
: Service principal name, appId or objectId that has the scopes (roles)
|
|
23
|
+
: Service principal name, appId or objectId that has the scopes (roles) e.g. `SharePoint`
|
|
24
24
|
|
|
25
25
|
`-s, --scope <scope>`
|
|
26
|
-
: Permissions known also as scopes and roles to be deleted from the application. If multiple permissions have to be deleted, they have to be comma
|
|
26
|
+
: Permissions known also as scopes and roles to be deleted from the application. If multiple permissions have to be deleted, they have to be comma-separated e.g. `Sites.Read.All`,`Sites.ReadWrite.All`
|
|
27
27
|
|
|
28
28
|
`--confirm`
|
|
29
29
|
: Don't prompt for confirming removing the all role assignment
|
|
@@ -54,7 +54,7 @@ Deletes multiple Microsoft Graph application permissions from an Azure AD applic
|
|
|
54
54
|
m365 aad approleassignment remove --appDisplayName "MyAppName" --resource "Microsoft Graph" --scope "Mail.Read,Mail.Send"
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
Deletes Microsoft Graph _Mail.Read_ application permissions from a system
|
|
57
|
+
Deletes Microsoft Graph _Mail.Read_ application permissions from a system-managed identity app with objectId _57907bf8-73fa-43a6-89a5-1f603e29e451_
|
|
58
58
|
|
|
59
59
|
```sh
|
|
60
60
|
m365 aad approleassignment remove --appObjectId "57907bf8-73fa-43a6-89a5-1f603e29e451" --resource "Microsoft Graph" --scope "Mail.Read"
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# flow owner add
|
|
2
|
+
|
|
3
|
+
Assigns permissions to a Power Automate flow
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
m365 flow owner add [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
`-e, --environmentName <environmentName>`
|
|
14
|
+
: The name of the environment.
|
|
15
|
+
|
|
16
|
+
`-f, --flowName <flowName>`
|
|
17
|
+
: The name of the Power Automate flow.
|
|
18
|
+
|
|
19
|
+
`--userId [userId]`
|
|
20
|
+
: The ID of the user. Specify either `userId`, `userName`, `groupId` or `groupName`.
|
|
21
|
+
|
|
22
|
+
`--userName [userName]`
|
|
23
|
+
: User principal name of the user. Specify either `userId`, `userName`, `groupId` or `groupName`.
|
|
24
|
+
|
|
25
|
+
`--groupId [groupId]`
|
|
26
|
+
: The ID of the group. Specify either `userId`, `userName`, `groupId` or `groupName`.
|
|
27
|
+
|
|
28
|
+
`--groupName [groupName]`
|
|
29
|
+
: The name of the group. Specify either `userId`, `userName`, `groupId` or `groupName`.
|
|
30
|
+
|
|
31
|
+
`--roleName <roleName>`
|
|
32
|
+
: Access level for the user on the flow. Valid options are `CanView` or `CanEdit`.
|
|
33
|
+
|
|
34
|
+
`--asAdmin`
|
|
35
|
+
: Run the command as admin.
|
|
36
|
+
|
|
37
|
+
--8<-- "docs/cmd/_global.md"
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
Assign owner permissions to a specific Power Automate flow for a user with ID
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
m365 flow owner add --userId 5c241023-2ba5-4ea8-a516-a2481a3e6c51 --environmentName Default-c5a5d746-3520-453f-8a69-780f8e44917e --flowName 72f2be4a-78c1-4220-a048-dbf557296a72 --roleName CanEdit
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Assign owner permissions to a specific Power Automate flow for a user with UPN
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
m365 flow owner add --userName "john.doe@contoso.com" --environmentName Default-c5a5d746-3520-453f-8a69-780f8e44917e --flowName 72f2be4a-78c1-4220-a048-dbf557296a72 --roleName CanEdit
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Assign owner permissions to a specific Power Automate flow for a group
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
m365 flow owner add --groupId 8d4d9f32-1ab0-4f81-9054-efbb1759e8e6 --environmentName Default-c5a5d746-3520-453f-8a69-780f8e44917e --flowName 72f2be4a-78c1-4220-a048-dbf557296a72 --roleName CanEdit
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Response
|
|
60
|
+
|
|
61
|
+
The command won't return a response on success.
|