@pnp/cli-microsoft365 6.0.0-beta.42305df → 6.0.0-beta.48a730d
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 +15 -2
- package/README.md +5 -0
- package/dist/Command.js +16 -2
- package/dist/m365/aad/commands/app/app-add.js +36 -13
- package/dist/m365/aad/commands/app/app-list.js +38 -0
- package/dist/m365/aad/commands/user/user-guest-add.js +103 -0
- package/dist/m365/aad/commands.js +2 -0
- package/dist/m365/commands/status.js +6 -1
- package/dist/m365/outlook/commands/mail/mail-send.js +55 -31
- package/dist/m365/outlook/commands/message/message-get.js +97 -0
- package/dist/m365/outlook/commands.js +1 -0
- package/dist/m365/planner/commands/bucket/bucket-get.js +1 -1
- package/dist/m365/planner/commands/plan/plan-get.js +5 -20
- package/dist/m365/pp/commands/Environment.js +3 -0
- package/dist/m365/pp/commands/card/card-get.js +110 -0
- package/dist/m365/pp/commands/card/card-list.js +68 -0
- package/dist/m365/pp/commands/card/card-remove.js +130 -0
- package/dist/m365/pp/commands/dataverse/dataverse-table-list.js +6 -12
- package/dist/m365/pp/commands/environment/environment-get.js +75 -0
- package/dist/m365/pp/commands/gateway/gateway-get.js +70 -0
- package/dist/m365/pp/commands/solution/Solution.js +3 -0
- package/dist/m365/pp/commands/solution/solution-get.js +117 -0
- package/dist/m365/pp/commands/solution/solution-list.js +87 -0
- package/dist/m365/pp/commands.js +7 -0
- package/dist/m365/spfx/commands/project/project-doctor.js +4 -1
- package/dist/m365/spfx/commands/project/project-externalize.js +4 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010001_YORC_version.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010002_YORC_isCreatingSolution.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010003_YORC_packageManager.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010004_YORC_componentType.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010005_YORC_environment.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010006_YORC_framework.js +3 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010007_YORC_isDomainIsolated.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010008_YORC_nodeVersion.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010009_YORC_sdkVersions_microsoft_graph_client.js +56 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010010_YORC_sdkVersions_teams_js.js +56 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.14.0.js +0 -2
- package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.16.0-beta.1.js → upgrade-1.16.0-beta.2.js} +44 -28
- package/dist/m365/spfx/commands/project/project-upgrade.js +5 -2
- package/dist/m365/spfx/commands/spfx-doctor.js +39 -9
- package/dist/m365/spo/commands/contenttype/contenttype-add.js +82 -43
- package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +53 -21
- package/dist/m365/spo/commands/contenttype/contenttype-get.js +35 -14
- package/dist/m365/spo/commands/eventreceiver/EventReceiver.js +3 -0
- package/dist/m365/spo/commands/eventreceiver/eventreceiver-remove.js +182 -0
- package/dist/m365/spo/commands/field/field-add.js +26 -1
- package/dist/m365/spo/commands/field/field-set.js +23 -13
- package/dist/m365/spo/commands/file/file-copy.js +25 -39
- package/dist/m365/spo/commands/file/file-move.js +24 -37
- package/dist/m365/spo/commands/file/file-rename.js +19 -16
- package/dist/m365/spo/commands/file/file-roleinheritance-break.js +129 -0
- package/dist/m365/spo/commands/folder/folder-list.js +35 -12
- package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +168 -0
- package/dist/m365/spo/commands/folder/folder-roleinheritance-break.js +11 -1
- package/dist/m365/spo/commands/folder/folder-roleinheritance-reset.js +12 -1
- package/dist/m365/spo/commands/group/AssociatedGroupPropertiesCollection.js +3 -0
- package/dist/m365/spo/commands/group/group-list.js +49 -10
- package/dist/m365/spo/commands/list/list-contenttype-add.js +21 -18
- package/dist/m365/spo/commands/list/list-contenttype-default-set.js +59 -47
- package/dist/m365/spo/commands/list/list-contenttype-list.js +16 -8
- package/dist/m365/spo/commands/list/list-contenttype-remove.js +16 -8
- package/dist/m365/spo/commands/list/list-roleassignment-add.js +10 -10
- package/dist/m365/spo/commands/list/list-roleassignment-remove.js +8 -8
- package/dist/m365/spo/commands/list/list-roleinheritance-break.js +14 -6
- package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +14 -6
- package/dist/m365/spo/commands/list/list-webhook-add.js +19 -11
- package/dist/m365/spo/commands/list/list-webhook-get.js +17 -10
- package/dist/m365/spo/commands/list/list-webhook-list.js +17 -42
- package/dist/m365/spo/commands/list/list-webhook-remove.js +19 -11
- package/dist/m365/spo/commands/list/list-webhook-set.js +27 -20
- package/dist/m365/spo/commands/listitem/listitem-add.js +24 -14
- package/dist/m365/spo/commands/listitem/listitem-attachment-list.js +18 -8
- package/dist/m365/spo/commands/listitem/listitem-get.js +18 -8
- package/dist/m365/spo/commands/listitem/listitem-isrecord.js +20 -10
- package/dist/m365/spo/commands/listitem/listitem-list.js +21 -11
- package/dist/m365/spo/commands/listitem/listitem-record-declare.js +19 -12
- package/dist/m365/spo/commands/listitem/listitem-record-undeclare.js +24 -21
- package/dist/m365/spo/commands/listitem/listitem-remove.js +19 -11
- package/dist/m365/spo/commands/listitem/listitem-roleassignment-add.js +239 -0
- package/dist/m365/spo/commands/listitem/listitem-roleassignment-remove.js +8 -8
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +13 -5
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +13 -5
- package/dist/m365/spo/commands/listitem/listitem-set.js +52 -44
- package/dist/m365/spo/commands/roledefinition/roledefinition-list.js +15 -2
- package/dist/m365/spo/commands/site/site-add.js +4 -11
- package/dist/m365/spo/commands/{hubsite/hubsite-connect.js → site/site-hubsite-connect.js} +10 -10
- package/dist/m365/spo/commands/{hubsite/hubsite-disconnect.js → site/site-hubsite-disconnect.js} +13 -13
- package/dist/m365/spo/commands/{hubsite/hubsite-theme-sync.js → site/site-hubsite-theme-sync.js} +11 -11
- package/dist/m365/spo/commands/web/web-roleassignment-add.js +10 -10
- package/dist/m365/spo/commands/web/web-roleassignment-remove.js +8 -8
- package/dist/m365/spo/commands/web/web-roleinheritance-break.js +100 -0
- package/dist/m365/spo/commands.js +8 -3
- package/dist/m365/teams/commands/channel/channel-add.js +9 -9
- package/dist/m365/teams/commands/team/team-set.js +0 -7
- package/dist/m365/todo/commands/list/list-get.js +89 -0
- package/dist/m365/todo/commands/task/task-add.js +55 -3
- package/dist/m365/todo/commands/task/task-get.js +108 -0
- package/dist/m365/todo/commands/task/task-set.js +53 -1
- package/dist/m365/todo/commands.js +2 -0
- package/dist/utils/md.js +8 -1
- package/docs/docs/_clisettings.md +18 -0
- package/docs/docs/cmd/aad/app/app-list.md +149 -0
- package/docs/docs/cmd/aad/user/user-guest-add.md +107 -0
- package/docs/docs/cmd/adaptivecard/adaptivecard-send.md +3 -0
- package/docs/docs/cmd/graph/schemaextension/schemaextension-add.md +4 -11
- package/docs/docs/cmd/graph/schemaextension/schemaextension-set.md +4 -10
- package/docs/docs/cmd/outlook/mail/mail-send.md +13 -0
- package/docs/docs/cmd/outlook/message/message-get.md +48 -0
- package/docs/docs/cmd/planner/bucket/bucket-add.md +29 -0
- package/docs/docs/cmd/planner/bucket/bucket-get.md +29 -0
- package/docs/docs/cmd/planner/bucket/bucket-list.md +30 -0
- package/docs/docs/cmd/planner/bucket/bucket-remove.md +4 -0
- package/docs/docs/cmd/planner/bucket/bucket-set.md +4 -0
- package/docs/docs/cmd/planner/plan/plan-add.md +123 -0
- package/docs/docs/cmd/planner/plan/plan-get.md +75 -6
- package/docs/docs/cmd/planner/plan/plan-list.md +45 -0
- package/docs/docs/cmd/planner/plan/plan-remove.md +4 -0
- package/docs/docs/cmd/planner/task/task-get.md +0 -3
- package/docs/docs/cmd/pp/card/card-get.md +51 -0
- package/docs/docs/cmd/pp/card/card-list.md +33 -0
- package/docs/docs/cmd/pp/card/card-remove.md +82 -0
- package/docs/docs/cmd/pp/dataverse/dataverse-table-list.md +2 -2
- package/docs/docs/cmd/pp/environment/environment-get.md +38 -0
- package/docs/docs/cmd/pp/environment/environment-list.md +1 -1
- package/docs/docs/cmd/pp/gateway/gateway-get.md +24 -0
- package/docs/docs/cmd/pp/solution/solution-get.md +51 -0
- package/docs/docs/cmd/pp/solution/solution-list.md +33 -0
- package/docs/docs/cmd/spfx/project/project-rename.md +1 -14
- package/docs/docs/cmd/spfx/project/project-upgrade.md +1 -1
- package/docs/docs/cmd/spfx/spfx-doctor.md +10 -1
- package/docs/docs/cmd/spo/contenttype/contenttype-add.md +20 -2
- package/docs/docs/cmd/spo/contenttype/contenttype-field-remove.md +22 -4
- package/docs/docs/cmd/spo/contenttype/contenttype-get.md +21 -3
- package/docs/docs/cmd/spo/customaction/customaction-add.md +3 -0
- package/docs/docs/cmd/spo/customaction/customaction-set.md +3 -2
- package/docs/docs/cmd/spo/eventreceiver/eventreceiver-get.md +2 -2
- package/docs/docs/cmd/spo/eventreceiver/eventreceiver-remove.md +69 -0
- package/docs/docs/cmd/spo/field/field-add.md +20 -2
- package/docs/docs/cmd/spo/field/field-set.md +15 -3
- package/docs/docs/cmd/spo/file/file-roleinheritance-break.md +54 -0
- package/docs/docs/cmd/spo/folder/folder-list.md +45 -0
- package/docs/docs/cmd/spo/folder/folder-roleassignment-remove.md +57 -0
- package/docs/docs/cmd/spo/folder/folder-roleinheritance-break.md +6 -0
- package/docs/docs/cmd/spo/folder/folder-roleinheritance-reset.md +6 -0
- package/docs/docs/cmd/spo/group/group-list.md +10 -1
- package/docs/docs/cmd/spo/hubsite/hubsite-register.md +2 -2
- package/docs/docs/cmd/spo/hubsite/hubsite-unregister.md +2 -2
- package/docs/docs/cmd/spo/list/list-contenttype-add.md +15 -6
- package/docs/docs/cmd/spo/list/list-contenttype-default-set.md +16 -7
- package/docs/docs/cmd/spo/list/list-contenttype-list.md +15 -6
- package/docs/docs/cmd/spo/list/list-contenttype-remove.md +16 -7
- package/docs/docs/cmd/spo/list/list-roleinheritance-break.md +11 -8
- package/docs/docs/cmd/spo/list/list-roleinheritance-reset.md +16 -7
- package/docs/docs/cmd/spo/list/list-view-set.md +14 -3
- package/docs/docs/cmd/spo/list/list-webhook-add.md +15 -16
- package/docs/docs/cmd/spo/list/list-webhook-get.md +16 -7
- package/docs/docs/cmd/spo/list/list-webhook-list.md +13 -10
- package/docs/docs/cmd/spo/list/list-webhook-remove.md +12 -10
- package/docs/docs/cmd/spo/list/list-webhook-set.md +21 -12
- package/docs/docs/cmd/spo/listitem/listitem-add.md +11 -2
- package/docs/docs/cmd/spo/listitem/listitem-attachment-list.md +11 -2
- package/docs/docs/cmd/spo/listitem/listitem-get.md +11 -2
- package/docs/docs/cmd/spo/listitem/listitem-isrecord.md +12 -2
- package/docs/docs/cmd/spo/listitem/listitem-list.md +10 -1
- package/docs/docs/cmd/spo/listitem/listitem-record-declare.md +7 -4
- package/docs/docs/cmd/spo/listitem/listitem-record-undeclare.md +11 -2
- package/docs/docs/cmd/spo/listitem/listitem-remove.md +11 -2
- package/docs/docs/cmd/spo/listitem/listitem-roleassignment-add.md +81 -0
- package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-break.md +7 -4
- package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-reset.md +8 -5
- package/docs/docs/cmd/spo/listitem/listitem-set.md +7 -4
- package/docs/docs/cmd/spo/page/page-clientsidewebpart-add.md +5 -10
- package/docs/docs/cmd/spo/page/page-control-set.md +2 -1
- package/docs/docs/cmd/spo/site/site-add.md +0 -3
- package/docs/docs/cmd/spo/{hubsite/hubsite-connect.md → site/site-hubsite-connect.md} +4 -4
- package/docs/docs/cmd/spo/{hubsite/hubsite-disconnect.md → site/site-hubsite-disconnect.md} +7 -7
- package/docs/docs/cmd/spo/{hubsite/hubsite-theme-sync.md → site/site-hubsite-theme-sync.md} +5 -5
- package/docs/docs/cmd/spo/term/term-add.md +5 -0
- package/docs/docs/cmd/spo/term/term-set-add.md +6 -1
- package/docs/docs/cmd/spo/web/web-roleinheritance-break.md +44 -0
- package/docs/docs/cmd/teams/channel/channel-add.md +4 -4
- package/docs/docs/cmd/teams/team/team-clone.md +0 -3
- package/docs/docs/cmd/teams/team/team-set.md +0 -3
- package/docs/docs/cmd/tenant/id/id-get.md +20 -0
- package/docs/docs/cmd/tenant/report/report-activeusercounts.md +35 -0
- package/docs/docs/cmd/tenant/report/report-activeuserdetail.md +49 -0
- package/docs/docs/cmd/tenant/report/report-office365activationcounts.md +32 -0
- package/docs/docs/cmd/tenant/report/report-office365activationsusercounts.md +30 -0
- package/docs/docs/cmd/tenant/report/report-office365activationsuserdetail.md +36 -0
- package/docs/docs/cmd/tenant/report/report-servicesusercounts.md +41 -0
- package/docs/docs/cmd/tenant/security/security-alerts-list.md +105 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-get.md +87 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-list.md +91 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-get.md +62 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-list.md +51 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-get.md +64 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-list.md +52 -0
- package/docs/docs/cmd/todo/list/list-get.md +61 -0
- package/docs/docs/cmd/todo/task/task-add.md +32 -5
- package/docs/docs/cmd/todo/task/task-get.md +75 -0
- package/docs/docs/cmd/todo/task/task-set.md +29 -2
- package/package.json +13 -3
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN006006_CFG_PS_features.js +0 -60
package/.eslintrc.js
CHANGED
|
@@ -174,7 +174,19 @@ module.exports = {
|
|
|
174
174
|
"eqeqeq": [
|
|
175
175
|
"error",
|
|
176
176
|
"always"
|
|
177
|
-
]
|
|
177
|
+
],
|
|
178
|
+
"@typescript-eslint/naming-convention": [
|
|
179
|
+
"error",
|
|
180
|
+
{
|
|
181
|
+
"selector": [
|
|
182
|
+
"method"
|
|
183
|
+
],
|
|
184
|
+
"format": [
|
|
185
|
+
"camelCase"
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
"@typescript-eslint/explicit-function-return-type": ["error", { "allowExpressions": true }]
|
|
178
190
|
},
|
|
179
191
|
"overrides": [
|
|
180
192
|
{
|
|
@@ -185,7 +197,8 @@ module.exports = {
|
|
|
185
197
|
"no-console": "error",
|
|
186
198
|
"@typescript-eslint/no-empty-function": "off",
|
|
187
199
|
"cli-microsoft365/correct-command-class-name": "off",
|
|
188
|
-
"cli-microsoft365/correct-command-name": "off"
|
|
200
|
+
"cli-microsoft365/correct-command-name": "off",
|
|
201
|
+
"@typescript-eslint/explicit-function-return-type": "off"
|
|
189
202
|
}
|
|
190
203
|
},
|
|
191
204
|
{
|
package/README.md
CHANGED
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
alt="GitHub" />
|
|
16
16
|
</a>
|
|
17
17
|
|
|
18
|
+
<a href="https://discord.com/invite/7rfW4kg6B5">
|
|
19
|
+
<img src="https://img.shields.io/badge/Discord-Join-7289da?style=flat-square"
|
|
20
|
+
alt="Discord" />
|
|
21
|
+
</a>
|
|
22
|
+
|
|
18
23
|
<a href="https://twitter.com/climicrosoft365">
|
|
19
24
|
<img src="https://img.shields.io/badge/Twitter-%40climicrosoft365-blue?style=flat-square"
|
|
20
25
|
alt="Twitter" />
|
package/dist/Command.js
CHANGED
|
@@ -61,6 +61,9 @@ class Command {
|
|
|
61
61
|
__classPrivateFieldGet(this, _Command_instances, "m", _Command_initOptions).call(this);
|
|
62
62
|
__classPrivateFieldGet(this, _Command_instances, "m", _Command_initValidators).call(this);
|
|
63
63
|
}
|
|
64
|
+
get allowedOutputs() {
|
|
65
|
+
return ['csv', 'json', 'text'];
|
|
66
|
+
}
|
|
64
67
|
validateUnknownOptions(args, command) {
|
|
65
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
69
|
if (this.allowUnknownOptions()) {
|
|
@@ -135,6 +138,17 @@ class Command {
|
|
|
135
138
|
return true;
|
|
136
139
|
});
|
|
137
140
|
}
|
|
141
|
+
validateOutput(args) {
|
|
142
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
+
if (args.options.output &&
|
|
144
|
+
this.allowedOutputs.indexOf(args.options.output) < 0) {
|
|
145
|
+
return `'${args.options.output}' is not a valid output type. Allowed output types are ${this.allowedOutputs.join(', ')}`;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
138
152
|
alias() {
|
|
139
153
|
return;
|
|
140
154
|
}
|
|
@@ -417,9 +431,9 @@ _Command_instances = new WeakSet(), _Command_initTelemetry = function _Command_i
|
|
|
417
431
|
}, _Command_initOptions = function _Command_initOptions() {
|
|
418
432
|
this.options.unshift({ option: '--query [query]' }, {
|
|
419
433
|
option: '-o, --output [output]',
|
|
420
|
-
autocomplete:
|
|
434
|
+
autocomplete: this.allowedOutputs
|
|
421
435
|
}, { option: '--verbose' }, { option: '--debug' });
|
|
422
436
|
}, _Command_initValidators = function _Command_initValidators() {
|
|
423
|
-
this.validators.push((args, command) => this.validateUnknownOptions(args, command), (args, command) => this.validateRequiredOptions(args, command), (args, command) => this.validateOptionSets(args, command));
|
|
437
|
+
this.validators.push((args, command) => this.validateUnknownOptions(args, command), (args, command) => this.validateRequiredOptions(args, command), args => this.validateOutput(args), (args, command) => this.validateOptionSets(args, command));
|
|
424
438
|
};
|
|
425
439
|
//# sourceMappingURL=Command.js.map
|
|
@@ -206,8 +206,6 @@ class AadAppAddCommand extends GraphCommand_1.default {
|
|
|
206
206
|
delete v2Manifest.appId;
|
|
207
207
|
delete v2Manifest.publisherDomain;
|
|
208
208
|
// extract secrets from the manifest. Store them in a separate variable
|
|
209
|
-
// and remove them from the manifest because we need to create them
|
|
210
|
-
// separately
|
|
211
209
|
const secrets = this.getSecretsFromManifest(v2Manifest);
|
|
212
210
|
// Azure Portal returns v2 manifest whereas the Graph API expects a v1.6
|
|
213
211
|
if (args.options.apisApplication || args.options.apisDelegated) {
|
|
@@ -215,6 +213,33 @@ class AadAppAddCommand extends GraphCommand_1.default {
|
|
|
215
213
|
// otherwise, they will be skipped in the app update
|
|
216
214
|
v2Manifest.requiredResourceAccess = appInfo.requiredResourceAccess;
|
|
217
215
|
}
|
|
216
|
+
if (args.options.redirectUris) {
|
|
217
|
+
// take submitted redirectUris/platform as options
|
|
218
|
+
// otherwise, they will be removed from the app
|
|
219
|
+
v2Manifest.replyUrlsWithType = args.options.redirectUris.split(',').map(u => {
|
|
220
|
+
return {
|
|
221
|
+
url: u.trim(),
|
|
222
|
+
type: this.translatePlatformToType(args.options.platform)
|
|
223
|
+
};
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
if (args.options.multitenant) {
|
|
227
|
+
// override manifest setting when using multitenant flag
|
|
228
|
+
v2Manifest.signInAudience = 'AzureADMultipleOrgs';
|
|
229
|
+
}
|
|
230
|
+
if (args.options.implicitFlow) {
|
|
231
|
+
// remove manifest settings when using implicitFlow flag
|
|
232
|
+
delete v2Manifest.oauth2AllowIdTokenImplicitFlow;
|
|
233
|
+
delete v2Manifest.oauth2AllowImplicitFlow;
|
|
234
|
+
}
|
|
235
|
+
if (args.options.scopeName) {
|
|
236
|
+
// override manifest setting when using options.
|
|
237
|
+
delete v2Manifest.oauth2Permissions;
|
|
238
|
+
}
|
|
239
|
+
if (args.options.certificateFile || args.options.certificateBase64Encoded) {
|
|
240
|
+
// override manifest setting when using options.
|
|
241
|
+
delete v2Manifest.keyCredentials;
|
|
242
|
+
}
|
|
218
243
|
const graphManifest = this.transformManifest(v2Manifest);
|
|
219
244
|
const updateAppRequestOptions = {
|
|
220
245
|
url: `${this.resource}/v1.0/myorganization/applications/${appInfo.id}`,
|
|
@@ -425,7 +450,6 @@ class AadAppAddCommand extends GraphCommand_1.default {
|
|
|
425
450
|
return odata_1.odata
|
|
426
451
|
.getAllItems(`${this.resource}/v1.0/myorganization/servicePrincipals?$select=appId,appRoles,id,oauth2PermissionScopes,servicePrincipalNames`)
|
|
427
452
|
.then(servicePrincipals => {
|
|
428
|
-
var _a;
|
|
429
453
|
let resolvedApis = [];
|
|
430
454
|
try {
|
|
431
455
|
if (args.options.apisDelegated || args.options.apisApplication) {
|
|
@@ -448,17 +472,10 @@ class AadAppAddCommand extends GraphCommand_1.default {
|
|
|
448
472
|
}
|
|
449
473
|
});
|
|
450
474
|
}
|
|
451
|
-
|
|
475
|
+
else {
|
|
452
476
|
const manifestApis = this.manifest.requiredResourceAccess;
|
|
453
477
|
manifestApis.forEach(manifestApi => {
|
|
454
|
-
|
|
455
|
-
if (requiredResource) {
|
|
456
|
-
// exclude if any duplicate required resources in both manifest and submitted options
|
|
457
|
-
requiredResource.resourceAccess.push(...manifestApi.resourceAccess.filter(manRes => !requiredResource.resourceAccess.some(res => res.id === manRes.id)));
|
|
458
|
-
}
|
|
459
|
-
else {
|
|
460
|
-
resolvedApis.push(manifestApi);
|
|
461
|
-
}
|
|
478
|
+
resolvedApis.push(manifestApi);
|
|
462
479
|
const app = servicePrincipals.find(servicePrincipals => servicePrincipals.appId === manifestApi.resourceAppId);
|
|
463
480
|
if (app) {
|
|
464
481
|
manifestApi.resourceAccess.forEach((res => {
|
|
@@ -547,7 +564,7 @@ class AadAppAddCommand extends GraphCommand_1.default {
|
|
|
547
564
|
}
|
|
548
565
|
}
|
|
549
566
|
configureSecret(args, appInfo, logger) {
|
|
550
|
-
if (!args.options.withSecret) {
|
|
567
|
+
if (!args.options.withSecret || (appInfo.secrets && appInfo.secrets.length > 0)) {
|
|
551
568
|
return Promise.resolve(appInfo);
|
|
552
569
|
}
|
|
553
570
|
if (this.verbose) {
|
|
@@ -643,6 +660,12 @@ class AadAppAddCommand extends GraphCommand_1.default {
|
|
|
643
660
|
}
|
|
644
661
|
return Promise.resolve(appInfo);
|
|
645
662
|
}
|
|
663
|
+
translatePlatformToType(platform) {
|
|
664
|
+
if (platform === 'publicClient') {
|
|
665
|
+
return 'InstalledClient';
|
|
666
|
+
}
|
|
667
|
+
return platform.charAt(0).toUpperCase() + platform.substring(1);
|
|
668
|
+
}
|
|
646
669
|
}
|
|
647
670
|
_AadAppAddCommand_instances = new WeakSet(), _AadAppAddCommand_initTelemetry = function _AadAppAddCommand_initTelemetry() {
|
|
648
671
|
this.telemetry.push((args) => {
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const odata_1 = require("../../../../utils/odata");
|
|
13
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
14
|
+
const commands_1 = require("../../commands");
|
|
15
|
+
class AadAppListCommand extends GraphCommand_1.default {
|
|
16
|
+
get name() {
|
|
17
|
+
return commands_1.default.APP_LIST;
|
|
18
|
+
}
|
|
19
|
+
get description() {
|
|
20
|
+
return 'Retrieves a list of Azure AD app registrations';
|
|
21
|
+
}
|
|
22
|
+
defaultProperties() {
|
|
23
|
+
return ['appId', 'id', 'displayName', "signInAudience"];
|
|
24
|
+
}
|
|
25
|
+
commandAction(logger) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
try {
|
|
28
|
+
const results = yield odata_1.odata.getAllItems(`${this.resource}/v1.0/applications`);
|
|
29
|
+
logger.log(results);
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
this.handleRejectedODataJsonPromise(err);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
module.exports = new AadAppListCommand();
|
|
38
|
+
//# sourceMappingURL=app-list.js.map
|
|
@@ -0,0 +1,103 @@
|
|
|
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 _AadUserGuestAddCommand_instances, _AadUserGuestAddCommand_initTelemetry, _AadUserGuestAddCommand_initOptions;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const request_1 = require("../../../../request");
|
|
19
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
20
|
+
const commands_1 = require("../../commands");
|
|
21
|
+
class AadUserGuestAddCommand extends GraphCommand_1.default {
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
_AadUserGuestAddCommand_instances.add(this);
|
|
25
|
+
__classPrivateFieldGet(this, _AadUserGuestAddCommand_instances, "m", _AadUserGuestAddCommand_initTelemetry).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _AadUserGuestAddCommand_instances, "m", _AadUserGuestAddCommand_initOptions).call(this);
|
|
27
|
+
}
|
|
28
|
+
get name() {
|
|
29
|
+
return commands_1.default.USER_GUEST_ADD;
|
|
30
|
+
}
|
|
31
|
+
get description() {
|
|
32
|
+
return 'Invite an external user to the organization';
|
|
33
|
+
}
|
|
34
|
+
defaultProperties() {
|
|
35
|
+
return ['id', 'inviteRedeemUrl', 'invitedUserDisplayName', 'invitedUserEmailAddress', 'invitedUserType', 'resetRedemption', 'sendInvitationMessage', 'status'];
|
|
36
|
+
}
|
|
37
|
+
commandAction(logger, args) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
try {
|
|
40
|
+
const requestOptions = {
|
|
41
|
+
url: `${this.resource}/v1.0/invitations`,
|
|
42
|
+
headers: {
|
|
43
|
+
accept: 'application/json;odata.metadata=none'
|
|
44
|
+
},
|
|
45
|
+
responseType: 'json',
|
|
46
|
+
data: {
|
|
47
|
+
invitedUserEmailAddress: args.options.emailAddress,
|
|
48
|
+
inviteRedirectUrl: args.options.inviteRedirectUrl || 'https://myapplications.microsoft.com',
|
|
49
|
+
invitedUserDisplayName: args.options.displayName,
|
|
50
|
+
sendInvitationMessage: args.options.sendInvitationMessage,
|
|
51
|
+
invitedUserMessageInfo: {
|
|
52
|
+
customizedMessageBody: args.options.welcomeMessage,
|
|
53
|
+
messageLanguage: args.options.messageLanguage || 'en-US',
|
|
54
|
+
ccRecipients: args.options.ccRecipients ? this.mapEmailsToRecipients([args.options.ccRecipients]) : undefined
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const result = yield request_1.default.post(requestOptions);
|
|
59
|
+
logger.log(result);
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
this.handleRejectedODataJsonPromise(err);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
mapEmailsToRecipients(emails) {
|
|
67
|
+
return emails.map(mail => ({
|
|
68
|
+
emailAddress: {
|
|
69
|
+
address: mail.trim()
|
|
70
|
+
}
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
_AadUserGuestAddCommand_instances = new WeakSet(), _AadUserGuestAddCommand_initTelemetry = function _AadUserGuestAddCommand_initTelemetry() {
|
|
75
|
+
this.telemetry.push((args) => {
|
|
76
|
+
Object.assign(this.telemetryProperties, {
|
|
77
|
+
displayName: typeof args.options.displayName !== 'undefined',
|
|
78
|
+
inviteRedirectUrl: typeof args.options.inviteRedirectUrl !== 'undefined',
|
|
79
|
+
welcomeMessage: typeof args.options.welcomeMessage !== 'undefined',
|
|
80
|
+
messageLanguage: typeof args.options.messageLanguage !== 'undefined',
|
|
81
|
+
ccRecipients: typeof args.options.ccRecipients !== 'undefined',
|
|
82
|
+
sendInvitationMessage: !!args.options.sendInvitationMessage
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}, _AadUserGuestAddCommand_initOptions = function _AadUserGuestAddCommand_initOptions() {
|
|
86
|
+
this.options.unshift({
|
|
87
|
+
option: '--emailAddress <emailAddress>'
|
|
88
|
+
}, {
|
|
89
|
+
option: '--displayName [displayName]'
|
|
90
|
+
}, {
|
|
91
|
+
option: '--inviteRedirectUrl [inviteRedirectUrl]'
|
|
92
|
+
}, {
|
|
93
|
+
option: '--welcomeMessage [welcomeMessage]'
|
|
94
|
+
}, {
|
|
95
|
+
option: '--messageLanguage [messageLanguage]'
|
|
96
|
+
}, {
|
|
97
|
+
option: '--ccRecipients [ccRecipients]'
|
|
98
|
+
}, {
|
|
99
|
+
option: '--sendInvitationMessage'
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
module.exports = new AadUserGuestAddCommand();
|
|
103
|
+
//# sourceMappingURL=user-guest-add.js.map
|
|
@@ -4,6 +4,7 @@ const prefix = 'aad';
|
|
|
4
4
|
exports.default = {
|
|
5
5
|
APP_ADD: `${prefix} app add`,
|
|
6
6
|
APP_GET: `${prefix} app get`,
|
|
7
|
+
APP_LIST: `${prefix} app list`,
|
|
7
8
|
APP_REMOVE: `${prefix} app remove`,
|
|
8
9
|
APP_ROLE_ADD: `${prefix} app role add`,
|
|
9
10
|
APP_ROLE_LIST: `${prefix} app role list`,
|
|
@@ -54,6 +55,7 @@ exports.default = {
|
|
|
54
55
|
SP_ADD: `${prefix} sp add`,
|
|
55
56
|
SP_GET: `${prefix} sp get`,
|
|
56
57
|
USER_GET: `${prefix} user get`,
|
|
58
|
+
USER_GUEST_ADD: `${prefix} user guest add`,
|
|
57
59
|
USER_HIBP: `${prefix} user hibp`,
|
|
58
60
|
USER_LIST: `${prefix} user list`,
|
|
59
61
|
USER_PASSWORD_VALIDATE: `${prefix} user password validate`,
|
|
@@ -37,12 +37,17 @@ class StatusCommand extends Command_1.default {
|
|
|
37
37
|
logger.logToStderr({
|
|
38
38
|
connectedAs: accessToken_1.accessToken.getUserNameFromAccessToken(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken),
|
|
39
39
|
authType: Auth_1.AuthType[Auth_1.default.service.authType],
|
|
40
|
+
appId: Auth_1.default.service.appId,
|
|
41
|
+
appTenant: Auth_1.default.service.tenant,
|
|
40
42
|
accessTokens: JSON.stringify(Auth_1.default.service.accessTokens, null, 2)
|
|
41
43
|
});
|
|
42
44
|
}
|
|
43
45
|
else {
|
|
44
46
|
logger.log({
|
|
45
|
-
connectedAs: accessToken_1.accessToken.getUserNameFromAccessToken(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken)
|
|
47
|
+
connectedAs: accessToken_1.accessToken.getUserNameFromAccessToken(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken),
|
|
48
|
+
authType: Auth_1.AuthType[Auth_1.default.service.authType],
|
|
49
|
+
appId: Auth_1.default.service.appId,
|
|
50
|
+
appTenant: Auth_1.default.service.tenant
|
|
46
51
|
});
|
|
47
52
|
}
|
|
48
53
|
}
|
|
@@ -15,10 +15,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
15
15
|
};
|
|
16
16
|
var _OutlookMailSendCommand_instances, _OutlookMailSendCommand_initTelemetry, _OutlookMailSendCommand_initOptions, _OutlookMailSendCommand_initValidators;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const fs = require("fs");
|
|
19
|
+
const path = require("path");
|
|
18
20
|
const Auth_1 = require("../../../../Auth");
|
|
19
21
|
const request_1 = require("../../../../request");
|
|
20
22
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
21
23
|
const commands_1 = require("../../commands");
|
|
24
|
+
const validation_1 = require("../../../../utils/validation");
|
|
22
25
|
class OutlookMailSendCommand extends GraphCommand_1.default {
|
|
23
26
|
constructor() {
|
|
24
27
|
super();
|
|
@@ -34,7 +37,6 @@ class OutlookMailSendCommand extends GraphCommand_1.default {
|
|
|
34
37
|
return 'Sends an email';
|
|
35
38
|
}
|
|
36
39
|
commandAction(logger, args) {
|
|
37
|
-
var _a, _b;
|
|
38
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
41
|
try {
|
|
40
42
|
const isAppOnlyAuth = Auth_1.Auth.isAppOnlyAuth(Auth_1.default.service.accessTokens[this.resource].accessToken);
|
|
@@ -48,28 +50,8 @@ class OutlookMailSendCommand extends GraphCommand_1.default {
|
|
|
48
50
|
'content-type': 'application/json'
|
|
49
51
|
},
|
|
50
52
|
responseType: 'json',
|
|
51
|
-
data:
|
|
52
|
-
message: {
|
|
53
|
-
subject: args.options.subject,
|
|
54
|
-
body: {
|
|
55
|
-
contentType: args.options.bodyContentType || 'Text',
|
|
56
|
-
content: args.options.bodyContents
|
|
57
|
-
},
|
|
58
|
-
toRecipients: this.mapEmailAddressesToRecipients(args.options.to.split(',')),
|
|
59
|
-
ccRecipients: this.mapEmailAddressesToRecipients((_a = args.options.cc) === null || _a === void 0 ? void 0 : _a.split(',')),
|
|
60
|
-
bccRecipients: this.mapEmailAddressesToRecipients((_b = args.options.bcc) === null || _b === void 0 ? void 0 : _b.split(',')),
|
|
61
|
-
importance: args.options.importance
|
|
62
|
-
},
|
|
63
|
-
saveToSentItems: args.options.saveToSentItems
|
|
64
|
-
}
|
|
53
|
+
data: this.getRequestBody(args.options)
|
|
65
54
|
};
|
|
66
|
-
if (args.options.mailbox) {
|
|
67
|
-
requestOptions.data.message.from = {
|
|
68
|
-
emailAddress: {
|
|
69
|
-
address: args.options.mailbox
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
55
|
yield request_1.default.post(requestOptions);
|
|
74
56
|
}
|
|
75
57
|
catch (err) {
|
|
@@ -77,15 +59,40 @@ class OutlookMailSendCommand extends GraphCommand_1.default {
|
|
|
77
59
|
}
|
|
78
60
|
});
|
|
79
61
|
}
|
|
80
|
-
|
|
81
|
-
if (!
|
|
82
|
-
return
|
|
62
|
+
mapEmailAddressToRecipient(email) {
|
|
63
|
+
if (!email) {
|
|
64
|
+
return undefined;
|
|
83
65
|
}
|
|
84
|
-
return
|
|
66
|
+
return {
|
|
85
67
|
emailAddress: {
|
|
86
68
|
address: email.trim()
|
|
87
69
|
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
getRequestBody(options) {
|
|
73
|
+
var _a, _b;
|
|
74
|
+
const attachments = typeof options.attachment === 'string' ? [options.attachment] : options.attachment;
|
|
75
|
+
const attachmentContents = attachments === null || attachments === void 0 ? void 0 : attachments.map(a => ({
|
|
76
|
+
'@odata.type': '#microsoft.graph.fileAttachment',
|
|
77
|
+
name: path.basename(a),
|
|
78
|
+
contentBytes: fs.readFileSync(a, { encoding: 'base64' })
|
|
88
79
|
}));
|
|
80
|
+
return ({
|
|
81
|
+
message: {
|
|
82
|
+
subject: options.subject,
|
|
83
|
+
body: {
|
|
84
|
+
contentType: options.bodyContentType || 'Text',
|
|
85
|
+
content: options.bodyContents
|
|
86
|
+
},
|
|
87
|
+
from: this.mapEmailAddressToRecipient(options.mailbox),
|
|
88
|
+
toRecipients: options.to.split(',').map(mail => this.mapEmailAddressToRecipient(mail)),
|
|
89
|
+
ccRecipients: (_a = options.cc) === null || _a === void 0 ? void 0 : _a.split(',').map(mail => this.mapEmailAddressToRecipient(mail)),
|
|
90
|
+
bccRecipients: (_b = options.bcc) === null || _b === void 0 ? void 0 : _b.split(',').map(mail => this.mapEmailAddressToRecipient(mail)),
|
|
91
|
+
importance: options.importance,
|
|
92
|
+
attachments: attachmentContents
|
|
93
|
+
},
|
|
94
|
+
saveToSentItems: options.saveToSentItems
|
|
95
|
+
});
|
|
89
96
|
}
|
|
90
97
|
}
|
|
91
98
|
_OutlookMailSendCommand_instances = new WeakSet(), _OutlookMailSendCommand_initTelemetry = function _OutlookMailSendCommand_initTelemetry() {
|
|
@@ -97,7 +104,8 @@ _OutlookMailSendCommand_instances = new WeakSet(), _OutlookMailSendCommand_initT
|
|
|
97
104
|
saveToSentItems: args.options.saveToSentItems,
|
|
98
105
|
importance: args.options.importance,
|
|
99
106
|
mailbox: typeof args.options.mailbox !== 'undefined',
|
|
100
|
-
sender: typeof args.options.sender !== 'undefined'
|
|
107
|
+
sender: typeof args.options.sender !== 'undefined',
|
|
108
|
+
attachment: typeof args.options.attachment !== 'undefined'
|
|
101
109
|
});
|
|
102
110
|
});
|
|
103
111
|
}, _OutlookMailSendCommand_initOptions = function _OutlookMailSendCommand_initOptions() {
|
|
@@ -121,6 +129,8 @@ _OutlookMailSendCommand_instances = new WeakSet(), _OutlookMailSendCommand_initT
|
|
|
121
129
|
}, {
|
|
122
130
|
option: '--importance [importance]',
|
|
123
131
|
autocomplete: ['low', 'normal', 'high']
|
|
132
|
+
}, {
|
|
133
|
+
option: '--attachment [attachment]'
|
|
124
134
|
}, {
|
|
125
135
|
option: '--saveToSentItems [saveToSentItems]'
|
|
126
136
|
});
|
|
@@ -129,16 +139,30 @@ _OutlookMailSendCommand_instances = new WeakSet(), _OutlookMailSendCommand_initT
|
|
|
129
139
|
if (args.options.bodyContentType &&
|
|
130
140
|
args.options.bodyContentType !== 'Text' &&
|
|
131
141
|
args.options.bodyContentType !== 'HTML') {
|
|
132
|
-
return `${args.options.
|
|
142
|
+
return `${args.options.bodyContentType} is not a valid value for the bodyContentType option. Allowed values are Text|HTML`;
|
|
133
143
|
}
|
|
134
|
-
if (args.options.saveToSentItems &&
|
|
135
|
-
args.options.saveToSentItems !== 'true' &&
|
|
136
|
-
args.options.saveToSentItems !== 'false') {
|
|
144
|
+
if (args.options.saveToSentItems && !validation_1.validation.isValidBoolean(args.options.saveToSentItems)) {
|
|
137
145
|
return `${args.options.saveToSentItems} is not a valid value for the saveToSentItems option. Allowed values are true|false`;
|
|
138
146
|
}
|
|
139
147
|
if (args.options.importance && ['low', 'normal', 'high'].indexOf(args.options.importance) === -1) {
|
|
140
148
|
return `'${args.options.importance}' is not a valid value for the importance option. Allowed values are low|normal|high`;
|
|
141
149
|
}
|
|
150
|
+
if (args.options.attachment) {
|
|
151
|
+
const attachments = typeof args.options.attachment === 'string' ? [args.options.attachment] : args.options.attachment;
|
|
152
|
+
for (const attachment of attachments) {
|
|
153
|
+
if (!fs.existsSync(attachment)) {
|
|
154
|
+
return `File with path '${attachment}' was not found.`;
|
|
155
|
+
}
|
|
156
|
+
if (!fs.lstatSync(attachment).isFile()) {
|
|
157
|
+
return `'${attachment}' is not a file.`;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const requestBody = this.getRequestBody(args.options);
|
|
161
|
+
// The max body size of the request is 4 194 304 chars before getting a 413 response
|
|
162
|
+
if (JSON.stringify(requestBody).length > 4194304) {
|
|
163
|
+
return 'Exceeded the max total size of attachments which is 3MB.';
|
|
164
|
+
}
|
|
165
|
+
}
|
|
142
166
|
return true;
|
|
143
167
|
}));
|
|
144
168
|
};
|
|
@@ -0,0 +1,97 @@
|
|
|
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 _OutlookMessageGetCommand_instances, _OutlookMessageGetCommand_initTelemetry, _OutlookMessageGetCommand_initOptions;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const Auth_1 = require("../../../../Auth");
|
|
19
|
+
const request_1 = require("../../../../request");
|
|
20
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
21
|
+
const commands_1 = require("../../commands");
|
|
22
|
+
class OutlookMessageGetCommand extends GraphCommand_1.default {
|
|
23
|
+
constructor() {
|
|
24
|
+
super();
|
|
25
|
+
_OutlookMessageGetCommand_instances.add(this);
|
|
26
|
+
__classPrivateFieldGet(this, _OutlookMessageGetCommand_instances, "m", _OutlookMessageGetCommand_initTelemetry).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _OutlookMessageGetCommand_instances, "m", _OutlookMessageGetCommand_initOptions).call(this);
|
|
28
|
+
}
|
|
29
|
+
get name() {
|
|
30
|
+
return commands_1.default.MESSAGE_GET;
|
|
31
|
+
}
|
|
32
|
+
get description() {
|
|
33
|
+
return 'Retrieves specified message';
|
|
34
|
+
}
|
|
35
|
+
commandAction(logger, args) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
try {
|
|
38
|
+
const isAppOnlyAuth = Auth_1.Auth.isAppOnlyAuth(Auth_1.default.service.accessTokens[this.resource].accessToken);
|
|
39
|
+
if (this.verbose) {
|
|
40
|
+
logger.logToStderr(`Retrieving message with id ${args.options.id} using ${isAppOnlyAuth ? 'app only permissions' : 'delegated permissions'}`);
|
|
41
|
+
}
|
|
42
|
+
let requestUrl = '';
|
|
43
|
+
if (isAppOnlyAuth) {
|
|
44
|
+
if (!args.options.userId && !args.options.userPrincipalName) {
|
|
45
|
+
throw `The option 'userId' or 'userPrincipalName' is required when retrieving an email using app only credentials`;
|
|
46
|
+
}
|
|
47
|
+
if (args.options.userId && args.options.userPrincipalName) {
|
|
48
|
+
throw `Both options 'userId' and 'userPrincipalName' cannot be set when retrieving an email using app only credentials`;
|
|
49
|
+
}
|
|
50
|
+
requestUrl += `users/${args.options.userId ? args.options.userId : args.options.userPrincipalName}`;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
if (args.options.userId && args.options.userPrincipalName) {
|
|
54
|
+
throw `Both options 'userId' and 'userPrincipalName' cannot be set when retrieving an email using delegated credentials`;
|
|
55
|
+
}
|
|
56
|
+
if (args.options.userId || args.options.userPrincipalName) {
|
|
57
|
+
requestUrl += `users/${args.options.userId ? args.options.userId : args.options.userPrincipalName}`;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
requestUrl += 'me';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
requestUrl += `/messages/${args.options.id}`;
|
|
64
|
+
const requestOptions = {
|
|
65
|
+
url: `${this.resource}/v1.0/${requestUrl}`,
|
|
66
|
+
headers: {
|
|
67
|
+
accept: 'application/json;odata.metadata=none'
|
|
68
|
+
},
|
|
69
|
+
responseType: 'json'
|
|
70
|
+
};
|
|
71
|
+
const res = yield request_1.default.get(requestOptions);
|
|
72
|
+
logger.log(res);
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
this.handleRejectedODataJsonPromise(err);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
_OutlookMessageGetCommand_instances = new WeakSet(), _OutlookMessageGetCommand_initTelemetry = function _OutlookMessageGetCommand_initTelemetry() {
|
|
81
|
+
this.telemetry.push((args) => {
|
|
82
|
+
Object.assign(this.telemetryProperties, {
|
|
83
|
+
userId: typeof args.options.userId !== 'undefined',
|
|
84
|
+
userPrincipalName: typeof args.options.userPrincipalName !== 'undefined'
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}, _OutlookMessageGetCommand_initOptions = function _OutlookMessageGetCommand_initOptions() {
|
|
88
|
+
this.options.unshift({
|
|
89
|
+
option: '-i, --id <id>'
|
|
90
|
+
}, {
|
|
91
|
+
option: '--userId [userId]'
|
|
92
|
+
}, {
|
|
93
|
+
option: '--userPrincipalName [userPrincipalName]'
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
module.exports = new OutlookMessageGetCommand();
|
|
97
|
+
//# sourceMappingURL=message-get.js.map
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const prefix = 'outlook';
|
|
4
4
|
exports.default = {
|
|
5
5
|
MAIL_SEND: `${prefix} mail send`,
|
|
6
|
+
MESSAGE_GET: `${prefix} message get`,
|
|
6
7
|
MESSAGE_LIST: `${prefix} message list`,
|
|
7
8
|
MESSAGE_MOVE: `${prefix} message move`,
|
|
8
9
|
REPORT_MAILACTIVITYCOUNTS: `${prefix} report mailactivitycounts`,
|
|
@@ -96,7 +96,7 @@ class PlannerBucketGetCommand extends GraphCommand_1.default {
|
|
|
96
96
|
const requestOptions = {
|
|
97
97
|
url: `${this.resource}/v1.0/planner/buckets/${id}`,
|
|
98
98
|
headers: {
|
|
99
|
-
accept: 'application/json'
|
|
99
|
+
accept: 'application/json;odata.metadata=none'
|
|
100
100
|
},
|
|
101
101
|
responseType: 'json'
|
|
102
102
|
};
|