@pnp/cli-microsoft365 6.4.0-beta.6b65014 → 6.4.0-beta.8c5ba0e

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.
Files changed (158) hide show
  1. package/README.md +12 -1
  2. package/dist/m365/aad/commands/user/user-get.js +3 -0
  3. package/dist/m365/aad/commands/user/user-set.js +3 -0
  4. package/dist/m365/aad/commands/user/user-signin-list.js +3 -0
  5. package/dist/m365/planner/commands/roster/roster-member-add.js +3 -0
  6. package/dist/m365/purview/commands/retentionevent/retentionevent-add.js +138 -0
  7. package/dist/m365/purview/commands/retentionlabel/retentionlabel-add.js +48 -14
  8. package/dist/m365/purview/commands.js +1 -0
  9. package/dist/m365/spfx/commands/spfx-doctor.js +43 -29
  10. package/dist/m365/spo/commands/group/group-member-add.js +54 -95
  11. package/dist/m365/spo/commands/navigation/navigation-node-add.js +5 -4
  12. package/dist/m365/spo/commands/navigation/navigation-node-set.js +5 -1
  13. package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +118 -0
  14. package/dist/m365/spo/commands/user/user-ensure.js +105 -0
  15. package/dist/m365/spo/commands.js +2 -0
  16. package/dist/utils/aadUser.js +37 -0
  17. package/dist/utils/md.js +7 -0
  18. package/dist/utils/spo.js +32 -0
  19. package/docs/docs/cmd/cli/completion/completion-clink-update.md +4 -4
  20. package/docs/docs/cmd/onenote/page/page-list.md +1 -1
  21. package/docs/docs/cmd/outlook/mail/mail-send.md +7 -3
  22. package/docs/docs/cmd/outlook/message/message-get.md +143 -0
  23. package/docs/docs/cmd/outlook/message/message-list.md +119 -0
  24. package/docs/docs/cmd/outlook/message/message-move.md +4 -0
  25. package/docs/docs/cmd/outlook/report/report-mailactivitycounts.md +40 -0
  26. package/docs/docs/cmd/outlook/report/report-mailactivityusercounts.md +40 -0
  27. package/docs/docs/cmd/outlook/report/report-mailactivityuserdetail.md +45 -0
  28. package/docs/docs/cmd/outlook/report/report-mailappusageappsusercounts.md +43 -0
  29. package/docs/docs/cmd/outlook/report/report-mailappusageusercounts.md +44 -0
  30. package/docs/docs/cmd/outlook/report/report-mailappusageuserdetail.md +48 -0
  31. package/docs/docs/cmd/outlook/report/report-mailappusageversionsusercounts.md +41 -0
  32. package/docs/docs/cmd/outlook/report/report-mailboxusagedetail.md +49 -0
  33. package/docs/docs/cmd/outlook/report/report-mailboxusagemailboxcount.md +37 -0
  34. package/docs/docs/cmd/outlook/report/report-mailboxusagequotastatusmailboxcounts.md +40 -0
  35. package/docs/docs/cmd/outlook/report/report-mailboxusagestorage.md +36 -0
  36. package/docs/docs/cmd/outlook/room/room-list.md +81 -0
  37. package/docs/docs/cmd/outlook/roomlist/roomlist-list.md +58 -0
  38. package/docs/docs/cmd/planner/plan/plan-add.md +3 -3
  39. package/docs/docs/cmd/planner/plan/plan-set.md +73 -7
  40. package/docs/docs/cmd/planner/roster/roster-add.md +16 -1
  41. package/docs/docs/cmd/planner/task/task-add.md +230 -0
  42. package/docs/docs/cmd/planner/task/task-checklistitem-add.md +55 -0
  43. package/docs/docs/cmd/planner/task/task-checklistitem-list.md +55 -0
  44. package/docs/docs/cmd/planner/task/task-checklistitem-remove.md +4 -0
  45. package/docs/docs/cmd/planner/task/task-get.md +131 -0
  46. package/docs/docs/cmd/planner/task/task-list.md +92 -0
  47. package/docs/docs/cmd/planner/task/task-reference-add.md +46 -0
  48. package/docs/docs/cmd/planner/task/task-reference-list.md +46 -0
  49. package/docs/docs/cmd/planner/task/task-reference-remove.md +4 -0
  50. package/docs/docs/cmd/planner/task/task-remove.md +4 -0
  51. package/docs/docs/cmd/planner/task/task-set.md +230 -0
  52. package/docs/docs/cmd/planner/tenant/tenant-settings-list.md +55 -0
  53. package/docs/docs/cmd/planner/tenant/tenant-settings-set.md +55 -0
  54. package/docs/docs/cmd/pp/card/card-get.md +2 -2
  55. package/docs/docs/cmd/pp/card/card-list.md +2 -2
  56. package/docs/docs/cmd/purview/retentionevent/retentionevent-add.md +149 -0
  57. package/docs/docs/cmd/purview/retentioneventtype/retentioneventtype-add.md +7 -7
  58. package/docs/docs/cmd/purview/retentionlabel/retentionlabel-add.md +12 -0
  59. package/docs/docs/cmd/skype/report/report-activitycounts.md +38 -0
  60. package/docs/docs/cmd/skype/report/report-activityusercounts.md +38 -0
  61. package/docs/docs/cmd/skype/report/report-activityuserdetail.md +67 -0
  62. package/docs/docs/cmd/spfx/project/project-doctor.md +3 -3
  63. package/docs/docs/cmd/spfx/project/project-externalize.md +3 -3
  64. package/docs/docs/cmd/spfx/project/project-permissions-grant.md +21 -0
  65. package/docs/docs/cmd/spfx/project/project-upgrade.md +3 -3
  66. package/docs/docs/cmd/spfx/spfx-doctor.md +3 -3
  67. package/docs/docs/cmd/spo/cdn/cdn-get.md +6 -6
  68. package/docs/docs/cmd/spo/cdn/cdn-origin-add.md +3 -3
  69. package/docs/docs/cmd/spo/cdn/cdn-origin-list.md +3 -3
  70. package/docs/docs/cmd/spo/cdn/cdn-origin-remove.md +3 -3
  71. package/docs/docs/cmd/spo/cdn/cdn-policy-list.md +3 -3
  72. package/docs/docs/cmd/spo/cdn/cdn-policy-set.md +3 -3
  73. package/docs/docs/cmd/spo/cdn/cdn-set.md +3 -3
  74. package/docs/docs/cmd/spo/externaluser/externaluser-list.md +2 -0
  75. package/docs/docs/cmd/spo/group/group-member-add.md +22 -0
  76. package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-get.md +2 -0
  77. package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-set.md +2 -0
  78. package/docs/docs/cmd/spo/homesite/homesite-remove.md +2 -0
  79. package/docs/docs/cmd/spo/homesite/homesite-set.md +2 -0
  80. package/docs/docs/cmd/spo/knowledgehub/knowledgehub-get.md +2 -0
  81. package/docs/docs/cmd/spo/knowledgehub/knowledgehub-remove.md +2 -0
  82. package/docs/docs/cmd/spo/knowledgehub/knowledgehub-set.md +3 -3
  83. package/docs/docs/cmd/spo/listitem/listitem-add.md +1 -1
  84. package/docs/docs/cmd/spo/listitem/listitem-batch-add.md +1 -1
  85. package/docs/docs/cmd/spo/listitem/listitem-set.md +1 -1
  86. package/docs/docs/cmd/spo/navigation/navigation-node-add.md +2 -2
  87. package/docs/docs/cmd/spo/navigation/navigation-node-set.md +1 -1
  88. package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-add.md +2 -0
  89. package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-list.md +2 -0
  90. package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-remove.md +2 -0
  91. package/docs/docs/cmd/spo/orgnewssite/orgnewssite-list.md +2 -0
  92. package/docs/docs/cmd/spo/orgnewssite/orgnewssite-remove.md +2 -0
  93. package/docs/docs/cmd/spo/orgnewssite/orgnewssite-set.md +3 -3
  94. package/docs/docs/cmd/spo/site/site-appcatalog-add.md +2 -0
  95. package/docs/docs/cmd/spo/site/site-appcatalog-remove.md +3 -3
  96. package/docs/docs/cmd/spo/site/site-commsite-enable.md +2 -0
  97. package/docs/docs/cmd/spo/site/site-list.md +3 -3
  98. package/docs/docs/cmd/spo/site/site-remove.md +3 -3
  99. package/docs/docs/cmd/spo/site/site-rename.md +3 -3
  100. package/docs/docs/cmd/spo/site/site-set.md +5 -5
  101. package/docs/docs/cmd/spo/storageentity/storageentity-remove.md +3 -3
  102. package/docs/docs/cmd/spo/storageentity/storageentity-set.md +3 -3
  103. package/docs/docs/cmd/spo/tenant/tenant-appcatalog-add.md +3 -3
  104. package/docs/docs/cmd/spo/tenant/tenant-appcatalogurl-get.md +2 -0
  105. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-add.md +3 -3
  106. package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-get.md +142 -0
  107. package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-list.md +2 -0
  108. package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-remove.md +3 -3
  109. package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-restore.md +3 -3
  110. package/docs/docs/cmd/spo/tenant/tenant-settings-list.md +2 -0
  111. package/docs/docs/cmd/spo/tenant/tenant-settings-set.md +2 -0
  112. package/docs/docs/cmd/spo/term/term-add.md +3 -3
  113. package/docs/docs/cmd/spo/term/term-get.md +3 -3
  114. package/docs/docs/cmd/spo/term/term-group-add.md +2 -0
  115. package/docs/docs/cmd/spo/term/term-group-get.md +2 -0
  116. package/docs/docs/cmd/spo/term/term-group-list.md +2 -0
  117. package/docs/docs/cmd/spo/term/term-list.md +3 -1
  118. package/docs/docs/cmd/spo/term/term-set-add.md +3 -3
  119. package/docs/docs/cmd/spo/term/term-set-get.md +2 -0
  120. package/docs/docs/cmd/spo/term/term-set-list.md +2 -0
  121. package/docs/docs/cmd/spo/theme/theme-apply.md +3 -3
  122. package/docs/docs/cmd/spo/theme/theme-get.md +2 -0
  123. package/docs/docs/cmd/spo/theme/theme-list.md +2 -0
  124. package/docs/docs/cmd/spo/theme/theme-remove.md +2 -0
  125. package/docs/docs/cmd/spo/theme/theme-set.md +3 -3
  126. package/docs/docs/cmd/spo/user/user-ensure.md +109 -0
  127. package/docs/docs/cmd/teams/channel/channel-get.md +1 -1
  128. package/docs/docs/cmd/teams/message/message-get.md +39 -4
  129. package/docs/docs/cmd/teams/message/message-list.md +41 -6
  130. package/docs/docs/cmd/teams/message/message-reply-list.md +39 -4
  131. package/docs/docs/cmd/teams/messagingsettings/messagingsettings-list.md +20 -2
  132. package/docs/docs/cmd/teams/messagingsettings/messagingsettings-set.md +8 -8
  133. package/docs/docs/cmd/teams/report/report-deviceusagedistributionusercounts.md +12 -5
  134. package/docs/docs/cmd/teams/report/report-deviceusageusercounts.md +13 -6
  135. package/docs/docs/cmd/teams/report/report-deviceusageuserdetail.md +14 -7
  136. package/docs/docs/cmd/teams/report/report-directroutingcalls.md +13 -6
  137. package/docs/docs/cmd/teams/report/report-pstncalls.md +13 -6
  138. package/docs/docs/cmd/teams/report/report-useractivitycounts.md +13 -6
  139. package/docs/docs/cmd/teams/report/report-useractivityusercounts.md +13 -6
  140. package/docs/docs/cmd/teams/report/report-useractivityuserdetail.md +13 -6
  141. package/docs/docs/cmd/teams/tab/tab-add.md +16 -0
  142. package/docs/docs/cmd/teams/tab/tab-get.md +17 -0
  143. package/docs/docs/cmd/teams/tab/tab-list.md +19 -0
  144. package/docs/docs/cmd/teams/team/team-add.md +77 -8
  145. package/docs/docs/cmd/teams/team/team-app-list.md +18 -2
  146. package/docs/docs/cmd/teams/team/team-archive.md +2 -2
  147. package/docs/docs/cmd/teams/team/team-clone.md +8 -8
  148. package/docs/docs/cmd/teams/team/team-get.md +34 -4
  149. package/docs/docs/cmd/teams/team/team-list.md +34 -3
  150. package/docs/docs/cmd/teams/team/team-remove.md +3 -3
  151. package/docs/docs/cmd/teams/team/team-set.md +8 -8
  152. package/docs/docs/cmd/teams/team/team-unarchive.md +3 -2
  153. package/docs/docs/cmd/teams/user/user-app-add.md +3 -3
  154. package/docs/docs/cmd/teams/user/user-app-list.md +18 -2
  155. package/docs/docs/cmd/teams/user/user-app-remove.md +4 -4
  156. package/docs/docs/cmd/teams/user/user-list.md +21 -4
  157. package/npm-shrinkwrap.json +277 -192
  158. package/package.json +13 -13
@@ -15,15 +15,14 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _SpoGroupMemberAddCommand_instances, _SpoGroupMemberAddCommand_initTelemetry, _SpoGroupMemberAddCommand_initOptions, _SpoGroupMemberAddCommand_initValidators, _SpoGroupMemberAddCommand_initOptionSets;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- const Cli_1 = require("../../../../cli/Cli");
19
18
  const request_1 = require("../../../../request");
20
19
  const formatting_1 = require("../../../../utils/formatting");
21
20
  const validation_1 = require("../../../../utils/validation");
22
- const AadUserGetCommand = require("../../../aad/commands/user/user-get");
23
- const AadGroupGetCommand = require("../../../aad/commands/group/group-get");
24
- const SpoUserGetCommand = require("../user/user-get");
25
21
  const SpoCommand_1 = require("../../../base/SpoCommand");
26
22
  const commands_1 = require("../../commands");
23
+ const aadUser_1 = require("../../../../utils/aadUser");
24
+ const aadGroup_1 = require("../../../../utils/aadGroup");
25
+ const spo_1 = require("../../../../utils/spo");
27
26
  class SpoGroupMemberAddCommand extends SpoCommand_1.default {
28
27
  get name() {
29
28
  return commands_1.default.GROUP_MEMBER_ADD;
@@ -48,21 +47,20 @@ class SpoGroupMemberAddCommand extends SpoCommand_1.default {
48
47
  const groupId = yield this.getGroupId(args, logger);
49
48
  const resolvedUsernameList = yield this.getValidUsers(args, logger);
50
49
  if (this.verbose) {
51
- logger.logToStderr(`Adding user(s) to SharePoint Group ${args.options.groupId || args.options.groupName}`);
50
+ logger.logToStderr(`Adding resource(s) to SharePoint Group ${args.options.groupId || args.options.groupName}`);
52
51
  }
53
- const data = {
54
- url: args.options.webUrl,
55
- peoplePickerInput: this.getFormattedUserList(resolvedUsernameList),
56
- roleValue: `group:${groupId}`
57
- };
58
52
  const requestOptions = {
59
53
  url: `${args.options.webUrl}/_api/SP.Web.ShareObject`,
60
54
  headers: {
61
- 'Accept': 'application/json;odata=nometadata',
62
- 'Content-type': 'application/json;odata=verbose'
55
+ accept: 'application/json;odata=nometadata',
56
+ 'content-type': 'application/json;odata=nometadata'
63
57
  },
64
- data: data,
65
- responseType: 'json'
58
+ responseType: 'json',
59
+ data: {
60
+ url: args.options.webUrl,
61
+ peoplePickerInput: this.getFormattedUserList(resolvedUsernameList),
62
+ roleValue: `group:${groupId}`
63
+ }
66
64
  };
67
65
  const sharingResult = yield request_1.default.post(requestOptions);
68
66
  if (sharingResult.ErrorMessage !== null) {
@@ -83,7 +81,7 @@ class SpoGroupMemberAddCommand extends SpoCommand_1.default {
83
81
  `GetByName('${formatting_1.formatting.encodeQueryParameter(args.options.groupName)}')` :
84
82
  `GetById('${args.options.groupId}')`;
85
83
  const requestOptions = {
86
- url: `${args.options.webUrl}/_api/web/sitegroups/${getGroupMethod}`,
84
+ url: `${args.options.webUrl}/_api/web/sitegroups/${getGroupMethod}?$select=Id`,
87
85
  headers: {
88
86
  'accept': 'application/json;odata=nometadata'
89
87
  },
@@ -91,91 +89,52 @@ class SpoGroupMemberAddCommand extends SpoCommand_1.default {
91
89
  };
92
90
  return request_1.default
93
91
  .get(requestOptions)
94
- .then(response => {
95
- const groupId = response.Id;
96
- if (!groupId) {
97
- return Promise.reject(`The specified group does not exist in the SharePoint site`);
98
- }
99
- return groupId;
100
- });
92
+ .then(response => response.Id);
101
93
  }
102
94
  getValidUsers(args, logger) {
103
- if (this.verbose) {
104
- logger.logToStderr(`Checking if the specified users exist`);
105
- }
106
- const validUserNames = [];
107
- const invalidUserNames = [];
108
- const userIdentifiers = args.options.userName || args.options.email || args.options.aadGroupId || args.options.aadGroupName || args.options.userId.toString();
109
- return Promise
110
- .all(userIdentifiers.split(',').map((userIdentifier) => __awaiter(this, void 0, void 0, function* () {
111
- const user = userIdentifier.trim();
112
- try {
113
- if (args.options.userId) {
114
- yield this.spoUserGet(args.options, user, logger, validUserNames);
115
- }
116
- else if (args.options.aadGroupId || args.options.aadGroupName) {
117
- yield this.aadGroupGet(args.options, user, logger, validUserNames);
118
- }
119
- else {
120
- yield this.aadUserGet(args.options, user, logger, validUserNames);
121
- }
122
- }
123
- catch (err) {
124
- logger.logToStderr(err.stderr);
125
- invalidUserNames.push(userIdentifier);
126
- return err;
127
- }
128
- })))
129
- .then(() => {
130
- if (invalidUserNames.length > 0) {
131
- return Promise.reject(`Users not added to the group because the following users don't exist: ${invalidUserNames.join(', ')}`);
132
- }
133
- return Promise.resolve(validUserNames);
134
- });
135
- }
136
- aadUserGet(options, userIdentifier, logger, validUserNames) {
95
+ var _a, _b, _c, _d;
137
96
  return __awaiter(this, void 0, void 0, function* () {
138
97
  if (this.verbose) {
139
- logger.logToStderr(`Get UPN from Azure AD for user ${userIdentifier}`);
98
+ logger.logToStderr('Checking if the specified users and groups exist');
140
99
  }
141
- const aadUserGetCommandoptions = Object.assign(Object.assign(Object.assign({}, (options.userName && { userName: userIdentifier })), (options.email && { email: userIdentifier })), { output: 'json', debug: options.debug, verbose: options.verbose });
142
- const aadUserGetOutput = yield Cli_1.Cli.executeCommandWithOutput(AadUserGetCommand, { options: Object.assign(Object.assign({}, aadUserGetCommandoptions), { _: [] }) });
143
- if (this.debug) {
144
- logger.logToStderr(aadUserGetOutput.stderr);
145
- }
146
- validUserNames.push(JSON.parse(aadUserGetOutput.stdout).userPrincipalName);
147
- });
148
- }
149
- aadGroupGet(options, userIdentifier, logger, validUserNames) {
150
- return __awaiter(this, void 0, void 0, function* () {
151
- if (this.verbose) {
152
- logger.logToStderr(`Get UPN from Azure AD for group ${userIdentifier}`);
153
- }
154
- const aadUserGetCommandoptions = Object.assign(Object.assign(Object.assign({}, (options.aadGroupId && { id: userIdentifier })), (options.aadGroupName && { title: userIdentifier })), { output: 'json', debug: options.debug, verbose: options.verbose });
155
- const aadGroupGetOutput = yield Cli_1.Cli.executeCommandWithOutput(AadGroupGetCommand, { options: Object.assign(Object.assign({}, aadUserGetCommandoptions), { _: [] }) });
156
- if (this.debug) {
157
- logger.logToStderr(aadGroupGetOutput.stderr);
158
- }
159
- validUserNames.push(JSON.parse(aadGroupGetOutput.stdout).mail);
160
- });
161
- }
162
- spoUserGet(options, userIdentifier, logger, validUserNames) {
163
- return __awaiter(this, void 0, void 0, function* () {
164
- if (this.verbose) {
165
- logger.logToStderr(`Get UPN from SharePoint for user ${userIdentifier}`);
166
- }
167
- const spoUserGetCommandoptions = {
168
- id: userIdentifier,
169
- webUrl: options.webUrl,
170
- output: 'json',
171
- debug: options.debug,
172
- verbose: options.verbose
173
- };
174
- const spoUserGetOutput = yield Cli_1.Cli.executeCommandWithOutput(SpoUserGetCommand, { options: Object.assign(Object.assign({}, spoUserGetCommandoptions), { _: [] }) });
175
- if (this.debug) {
176
- logger.logToStderr(spoUserGetOutput.stderr);
177
- }
178
- validUserNames.push(JSON.parse(spoUserGetOutput.stdout).UserPrincipalName);
100
+ const validUserNames = [];
101
+ const identifiers = (_d = (_c = (_b = (_a = args.options.userName) !== null && _a !== void 0 ? _a : args.options.email) !== null && _b !== void 0 ? _b : args.options.aadGroupId) !== null && _c !== void 0 ? _c : args.options.aadGroupName) !== null && _d !== void 0 ? _d : args.options.userId.toString();
102
+ yield Promise.all(identifiers.split(',').map((identifier) => __awaiter(this, void 0, void 0, function* () {
103
+ const trimmedIdentifier = identifier.trim();
104
+ try {
105
+ if (args.options.userId) {
106
+ if (this.verbose) {
107
+ logger.logToStderr(`Getting AAD ID of user with ID ${trimmedIdentifier}`);
108
+ }
109
+ const spoUserAzureId = yield spo_1.spo.getUserAzureIdBySpoId(args.options.webUrl, trimmedIdentifier);
110
+ validUserNames.push(spoUserAzureId);
111
+ }
112
+ else if (args.options.userName) {
113
+ validUserNames.push(trimmedIdentifier);
114
+ }
115
+ else if (args.options.aadGroupId) {
116
+ validUserNames.push(trimmedIdentifier);
117
+ }
118
+ else if (args.options.aadGroupName) {
119
+ if (this.verbose) {
120
+ logger.logToStderr(`Getting ID of Azure AD group ${trimmedIdentifier}`);
121
+ }
122
+ const groupId = yield aadGroup_1.aadGroup.getGroupIdByDisplayName(trimmedIdentifier);
123
+ validUserNames.push(groupId);
124
+ }
125
+ else {
126
+ if (this.verbose) {
127
+ logger.logToStderr(`Getting Azure AD ID for user ${trimmedIdentifier}`);
128
+ }
129
+ const upn = yield aadUser_1.aadUser.getUserIdByEmail(trimmedIdentifier);
130
+ validUserNames.push(upn);
131
+ }
132
+ }
133
+ catch (err) {
134
+ throw `Resource '${trimmedIdentifier}' does not exist.`;
135
+ }
136
+ })));
137
+ return validUserNames;
179
138
  });
180
139
  }
181
140
  getFormattedUserList(activeUserList) {
@@ -38,7 +38,7 @@ class SpoNavigationNodeAddCommand extends SpoCommand_1.default {
38
38
  return ['url'];
39
39
  }
40
40
  commandAction(logger, args) {
41
- var _a;
41
+ var _a, _b;
42
42
  return __awaiter(this, void 0, void 0, function* () {
43
43
  if (this.verbose) {
44
44
  logger.logToStderr(`Adding navigation node...`);
@@ -56,7 +56,7 @@ class SpoNavigationNodeAddCommand extends SpoCommand_1.default {
56
56
  data: {
57
57
  AudienceIds: (_a = args.options.audienceIds) === null || _a === void 0 ? void 0 : _a.split(','),
58
58
  Title: args.options.title,
59
- Url: args.options.url,
59
+ Url: (_b = args.options.url) !== null && _b !== void 0 ? _b : 'http://linkless.header/',
60
60
  IsExternal: args.options.isExternal === true
61
61
  }
62
62
  };
@@ -76,7 +76,8 @@ _SpoNavigationNodeAddCommand_instances = new WeakSet(), _SpoNavigationNodeAddCom
76
76
  isExternal: args.options.isExternal,
77
77
  location: typeof args.options.location !== 'undefined',
78
78
  parentNodeId: typeof args.options.parentNodeId !== 'undefined',
79
- audienceIds: typeof args.options.audienceIds !== 'undefined'
79
+ audienceIds: typeof args.options.audienceIds !== 'undefined',
80
+ url: typeof args.options.url !== 'undefined'
80
81
  });
81
82
  });
82
83
  }, _SpoNavigationNodeAddCommand_initOptions = function _SpoNavigationNodeAddCommand_initOptions() {
@@ -88,7 +89,7 @@ _SpoNavigationNodeAddCommand_instances = new WeakSet(), _SpoNavigationNodeAddCom
88
89
  }, {
89
90
  option: '-t, --title <title>'
90
91
  }, {
91
- option: '--url <url>'
92
+ option: '--url [url]'
92
93
  }, {
93
94
  option: '--parentNodeId [parentNodeId]'
94
95
  }, {
@@ -40,10 +40,14 @@ class SpoNavigationNodeSetCommand extends SpoCommand_1.default {
40
40
  if (this.verbose) {
41
41
  logger.logToStderr(`Setting navigation node...`);
42
42
  }
43
+ let url = args.options.url;
44
+ if (url === '') {
45
+ url = 'http://linkless.header/';
46
+ }
43
47
  const requestBody = {
44
48
  Title: args.options.title,
45
49
  IsExternal: args.options.isExternal,
46
- Url: args.options.url
50
+ Url: url
47
51
  };
48
52
  if (args.options.audienceIds !== undefined) {
49
53
  requestBody.AudienceIds = args.options.audienceIds === '' ? [] : args.options.audienceIds.split(',');
@@ -0,0 +1,118 @@
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 _SpoTenantApplicationCustomizerGetCommand_instances, _SpoTenantApplicationCustomizerGetCommand_initTelemetry, _SpoTenantApplicationCustomizerGetCommand_initOptions, _SpoTenantApplicationCustomizerGetCommand_initValidators, _SpoTenantApplicationCustomizerGetCommand_initOptionSets;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Command_1 = require("../../../../Command");
19
+ const request_1 = require("../../../../request");
20
+ const formatting_1 = require("../../../../utils/formatting");
21
+ const spo_1 = require("../../../../utils/spo");
22
+ const urlUtil_1 = require("../../../../utils/urlUtil");
23
+ const validation_1 = require("../../../../utils/validation");
24
+ const SpoCommand_1 = require("../../../base/SpoCommand");
25
+ const commands_1 = require("../../commands");
26
+ class SpoTenantApplicationCustomizerGetCommand extends SpoCommand_1.default {
27
+ get name() {
28
+ return commands_1.default.TENANT_APPLICATIONCUSTOMIZER_GET;
29
+ }
30
+ get description() {
31
+ return 'Get an application customizer that is installed tenant wide';
32
+ }
33
+ constructor() {
34
+ super();
35
+ _SpoTenantApplicationCustomizerGetCommand_instances.add(this);
36
+ __classPrivateFieldGet(this, _SpoTenantApplicationCustomizerGetCommand_instances, "m", _SpoTenantApplicationCustomizerGetCommand_initTelemetry).call(this);
37
+ __classPrivateFieldGet(this, _SpoTenantApplicationCustomizerGetCommand_instances, "m", _SpoTenantApplicationCustomizerGetCommand_initOptions).call(this);
38
+ __classPrivateFieldGet(this, _SpoTenantApplicationCustomizerGetCommand_instances, "m", _SpoTenantApplicationCustomizerGetCommand_initValidators).call(this);
39
+ __classPrivateFieldGet(this, _SpoTenantApplicationCustomizerGetCommand_instances, "m", _SpoTenantApplicationCustomizerGetCommand_initOptionSets).call(this);
40
+ }
41
+ commandAction(logger, args) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const appCatalogUrl = yield spo_1.spo.getTenantAppCatalogUrl(logger, this.debug);
44
+ if (!appCatalogUrl) {
45
+ throw new Command_1.CommandError('No app catalog URL found');
46
+ }
47
+ let filter = '';
48
+ if (args.options.title) {
49
+ filter = `Title eq '${args.options.title}'`;
50
+ }
51
+ else if (args.options.id) {
52
+ filter = `GUID eq '${args.options.id}'`;
53
+ }
54
+ else if (args.options.clientSideComponentId) {
55
+ filter = `TenantWideExtensionComponentId eq '${args.options.clientSideComponentId}'`;
56
+ }
57
+ const listServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(appCatalogUrl, '/lists/TenantWideExtensions');
58
+ const reqOptions = {
59
+ url: `${appCatalogUrl}/_api/web/GetList('${formatting_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')/items?$filter=${filter}`,
60
+ headers: {
61
+ 'accept': 'application/json;odata=nometadata'
62
+ },
63
+ responseType: 'json'
64
+ };
65
+ let listItemInstances;
66
+ try {
67
+ listItemInstances = yield request_1.default.get(reqOptions);
68
+ }
69
+ catch (err) {
70
+ return this.handleRejectedODataJsonPromise(err);
71
+ }
72
+ if (listItemInstances) {
73
+ if (listItemInstances.value.length === 0) {
74
+ throw new Command_1.CommandError('The specified application customizer was not found');
75
+ }
76
+ if (listItemInstances.value.length > 1) {
77
+ throw new Command_1.CommandError(`Multiple application customizers with ${args.options.title || args.options.clientSideComponentId} were found. Please disambiguate (IDs): ${listItemInstances.value.map(item => item.GUID).join(', ')}`);
78
+ }
79
+ listItemInstances.value.forEach(v => delete v['ID']);
80
+ logger.log(listItemInstances.value[0]);
81
+ }
82
+ else {
83
+ throw new Command_1.CommandError('The specified application customizer was not found');
84
+ }
85
+ });
86
+ }
87
+ }
88
+ _SpoTenantApplicationCustomizerGetCommand_instances = new WeakSet(), _SpoTenantApplicationCustomizerGetCommand_initTelemetry = function _SpoTenantApplicationCustomizerGetCommand_initTelemetry() {
89
+ this.telemetry.push((args) => {
90
+ Object.assign(this.telemetryProperties, {
91
+ title: typeof args.options.title !== 'undefined',
92
+ id: typeof args.options.id !== 'undefined',
93
+ clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined'
94
+ });
95
+ });
96
+ }, _SpoTenantApplicationCustomizerGetCommand_initOptions = function _SpoTenantApplicationCustomizerGetCommand_initOptions() {
97
+ this.options.unshift({
98
+ option: '-t, --title [title]'
99
+ }, {
100
+ option: '-i, --id [id]'
101
+ }, {
102
+ option: '-c, --clientSideComponentId [clientSideComponentId]'
103
+ });
104
+ }, _SpoTenantApplicationCustomizerGetCommand_initValidators = function _SpoTenantApplicationCustomizerGetCommand_initValidators() {
105
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
106
+ if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
107
+ return `${args.options.id} is not a valid GUID`;
108
+ }
109
+ if (args.options.clientSideComponentId && !validation_1.validation.isValidGuid(args.options.clientSideComponentId)) {
110
+ return `${args.options.clientSideComponentId} is not a valid GUID`;
111
+ }
112
+ return true;
113
+ }));
114
+ }, _SpoTenantApplicationCustomizerGetCommand_initOptionSets = function _SpoTenantApplicationCustomizerGetCommand_initOptionSets() {
115
+ this.optionSets.push({ options: ['title', 'id', 'clientSideComponentId'] });
116
+ };
117
+ module.exports = new SpoTenantApplicationCustomizerGetCommand();
118
+ //# sourceMappingURL=tenant-applicationcustomizer-get.js.map
@@ -0,0 +1,105 @@
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 _SpoUserEnsureCommand_instances, _SpoUserEnsureCommand_initTelemetry, _SpoUserEnsureCommand_initOptions, _SpoUserEnsureCommand_initValidators, _SpoUserEnsureCommand_initOptionSets;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const request_1 = require("../../../../request");
19
+ const aadUser_1 = require("../../../../utils/aadUser");
20
+ const validation_1 = require("../../../../utils/validation");
21
+ const SpoCommand_1 = require("../../../base/SpoCommand");
22
+ const commands_1 = require("../../commands");
23
+ class SpoUserEnsureCommand extends SpoCommand_1.default {
24
+ get name() {
25
+ return commands_1.default.USER_ENSURE;
26
+ }
27
+ get description() {
28
+ return 'Ensures that a user is available on a specific site';
29
+ }
30
+ constructor() {
31
+ super();
32
+ _SpoUserEnsureCommand_instances.add(this);
33
+ __classPrivateFieldGet(this, _SpoUserEnsureCommand_instances, "m", _SpoUserEnsureCommand_initTelemetry).call(this);
34
+ __classPrivateFieldGet(this, _SpoUserEnsureCommand_instances, "m", _SpoUserEnsureCommand_initOptions).call(this);
35
+ __classPrivateFieldGet(this, _SpoUserEnsureCommand_instances, "m", _SpoUserEnsureCommand_initValidators).call(this);
36
+ __classPrivateFieldGet(this, _SpoUserEnsureCommand_instances, "m", _SpoUserEnsureCommand_initOptionSets).call(this);
37
+ }
38
+ commandAction(logger, args) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ if (this.verbose) {
41
+ logger.logToStderr(`Ensuring user ${args.options.aadId || args.options.userName} at site ${args.options.webUrl}`);
42
+ }
43
+ try {
44
+ const requestBody = {
45
+ logonName: args.options.userName || (yield this.getUpnByUserId(args.options.aadId, logger))
46
+ };
47
+ const requestOptions = {
48
+ url: `${args.options.webUrl}/_api/web/ensureuser`,
49
+ headers: {
50
+ accept: 'application/json;odata=nometadata'
51
+ },
52
+ data: requestBody,
53
+ responseType: 'json'
54
+ };
55
+ const response = yield request_1.default.post(requestOptions);
56
+ logger.log(response);
57
+ }
58
+ catch (err) {
59
+ this.handleRejectedODataJsonPromise(err);
60
+ }
61
+ });
62
+ }
63
+ getUpnByUserId(aadId, logger) {
64
+ return __awaiter(this, void 0, void 0, function* () {
65
+ if (this.verbose) {
66
+ logger.logToStderr(`Retrieving user principal name for user with id ${aadId}`);
67
+ }
68
+ return yield aadUser_1.aadUser.getUpnByUserId(aadId);
69
+ });
70
+ }
71
+ }
72
+ _SpoUserEnsureCommand_instances = new WeakSet(), _SpoUserEnsureCommand_initTelemetry = function _SpoUserEnsureCommand_initTelemetry() {
73
+ this.telemetry.push((args) => {
74
+ Object.assign(this.telemetryProperties, {
75
+ aadId: typeof args.options.aadId !== 'undefined',
76
+ userName: typeof args.options.userName !== 'undefined'
77
+ });
78
+ });
79
+ }, _SpoUserEnsureCommand_initOptions = function _SpoUserEnsureCommand_initOptions() {
80
+ this.options.unshift({
81
+ option: '-u, --webUrl <webUrl>'
82
+ }, {
83
+ option: '--aadId [aadId]'
84
+ }, {
85
+ option: '--userName [userName]'
86
+ });
87
+ }, _SpoUserEnsureCommand_initValidators = function _SpoUserEnsureCommand_initValidators() {
88
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
89
+ const isValidSharePointUrl = validation_1.validation.isValidSharePointUrl(args.options.webUrl);
90
+ if (isValidSharePointUrl !== true) {
91
+ return isValidSharePointUrl;
92
+ }
93
+ if (args.options.aadId && !validation_1.validation.isValidGuid(args.options.aadId)) {
94
+ return `${args.options.aadId} is not a valid GUID.`;
95
+ }
96
+ if (args.options.userName && !validation_1.validation.isValidUserPrincipalName(args.options.userName)) {
97
+ return `${args.options.userName} is not a valid userName.`;
98
+ }
99
+ return true;
100
+ }));
101
+ }, _SpoUserEnsureCommand_initOptionSets = function _SpoUserEnsureCommand_initOptionSets() {
102
+ this.optionSets.push({ options: ['aadId', 'userName'] });
103
+ };
104
+ module.exports = new SpoUserEnsureCommand();
105
+ //# sourceMappingURL=user-ensure.js.map
@@ -279,6 +279,7 @@ exports.default = {
279
279
  TENANT_APPCATALOG_ADD: `${prefix} tenant appcatalog add`,
280
280
  TENANT_APPCATALOGURL_GET: `${prefix} tenant appcatalogurl get`,
281
281
  TENANT_APPLICATIONCUSTOMIZER_ADD: `${prefix} tenant applicationcustomizer add`,
282
+ TENANT_APPLICATIONCUSTOMIZER_GET: `${prefix} tenant applicationcustomizer get`,
282
283
  TENANT_RECYCLEBINITEM_LIST: `${prefix} tenant recyclebinitem list`,
283
284
  TENANT_RECYCLEBINITEM_REMOVE: `${prefix} tenant recyclebinitem remove`,
284
285
  TENANT_RECYCLEBINITEM_RESTORE: `${prefix} tenant recyclebinitem restore`,
@@ -298,6 +299,7 @@ exports.default = {
298
299
  THEME_LIST: `${prefix} theme list`,
299
300
  THEME_REMOVE: `${prefix} theme remove`,
300
301
  THEME_SET: `${prefix} theme set`,
302
+ USER_ENSURE: `${prefix} user ensure`,
301
303
  USER_GET: `${prefix} user get`,
302
304
  USER_LIST: `${prefix} user list`,
303
305
  USER_REMOVE: `${prefix} user remove`,
@@ -33,6 +33,43 @@ exports.aadUser = {
33
33
  }
34
34
  return res.value[0].id;
35
35
  });
36
+ },
37
+ /**
38
+ * Retrieve the ID of a user by its email.
39
+ * @param mail User email.
40
+ */
41
+ getUserIdByEmail(email) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const requestOptions = {
44
+ url: `${graphResource}/v1.0/users?$filter=mail eq '${formatting_1.formatting.encodeQueryParameter(email)}'&$select=id`,
45
+ headers: {
46
+ accept: 'application/json;odata.metadata=none'
47
+ },
48
+ responseType: 'json'
49
+ };
50
+ const res = yield request_1.default.get(requestOptions);
51
+ if (res.value.length === 0) {
52
+ throw Error(`The specified user with email ${email} does not exist`);
53
+ }
54
+ return res.value[0].id;
55
+ });
56
+ },
57
+ /**
58
+ * Retrieve the UPN of a user by its ID.
59
+ * @param id User ID.
60
+ */
61
+ getUpnByUserId(id) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ const requestOptions = {
64
+ url: `${graphResource}/v1.0/users/${id}?$select=userPrincipalName`,
65
+ headers: {
66
+ accept: 'application/json;odata.metadata=none'
67
+ },
68
+ responseType: 'json'
69
+ };
70
+ const res = yield request_1.default.get(requestOptions);
71
+ return res.userPrincipalName;
72
+ });
36
73
  }
37
74
  };
38
75
  //# sourceMappingURL=aadUser.js.map
package/dist/utils/md.js CHANGED
@@ -51,6 +51,12 @@ function convertContentTabs(md) {
51
51
  return ` ${title}${os_1.EOL}${os_1.EOL}${content.replace(/^ /gms, '')}`;
52
52
  });
53
53
  }
54
+ function convertMdOutput(md) {
55
+ const regex = new RegExp('(?<=^ ```md)(.*)(?= ```)', 'gms');
56
+ return md.replace(regex, (match, content) => {
57
+ return content.replace(/^ /gms, '');
58
+ });
59
+ }
54
60
  function convertCodeFences(md) {
55
61
  const regex = new RegExp('^```.*?(?:\r\n|\n)(.*?)```(?:\r\n|\n)', 'gms');
56
62
  return md.replace(regex, (match, code) => {
@@ -79,6 +85,7 @@ const convertFunctions = [
79
85
  convertAdmonitions,
80
86
  convertDd,
81
87
  convertHyperlinks,
88
+ convertMdOutput,
82
89
  convertContentTabs,
83
90
  convertCodeFences,
84
91
  removeInlineMarkup,
package/dist/utils/spo.js CHANGED
@@ -536,6 +536,38 @@ exports.spo = {
536
536
  const customActionOnSite = yield getById(webUrl, id, "Site");
537
537
  return customActionOnSite;
538
538
  });
539
+ },
540
+ getTenantAppCatalogUrl(logger, debug) {
541
+ return __awaiter(this, void 0, void 0, function* () {
542
+ const spoUrl = yield exports.spo.getSpoUrl(logger, debug);
543
+ const requestOptions = {
544
+ url: `${spoUrl}/_api/SP_TenantSettings_Current`,
545
+ headers: {
546
+ accept: 'application/json;odata=nometadata'
547
+ },
548
+ responseType: 'json'
549
+ };
550
+ const result = yield request_1.default.get(requestOptions);
551
+ return result.CorporateCatalogUrl;
552
+ });
553
+ },
554
+ /**
555
+ * Retrieves the Azure AD ID from a SP user.
556
+ * @param webUrl Web url
557
+ * @param id The Id of the user
558
+ */
559
+ getUserAzureIdBySpoId(webUrl, id) {
560
+ return __awaiter(this, void 0, void 0, function* () {
561
+ const requestOptions = {
562
+ url: `${webUrl}/_api/web/siteusers/GetById('${formatting_1.formatting.encodeQueryParameter(id)}')?$select=AadObjectId`,
563
+ headers: {
564
+ accept: 'application/json;odata=nometadata'
565
+ },
566
+ responseType: 'json'
567
+ };
568
+ const res = yield request_1.default.get(requestOptions);
569
+ return res.AadObjectId.NameId;
570
+ });
539
571
  }
540
572
  };
541
573
  //# sourceMappingURL=spo.js.map
@@ -12,16 +12,16 @@ m365 cli completion clink update [options]
12
12
 
13
13
  --8<-- "docs/cmd/_global.md"
14
14
 
15
- !!! important
16
- Before running this command, change the working directory to where your shell stores completion plugins. For cmder, it's `%CMDER_ROOT%\vendor\clink-completions`, where `%CMDER_ROOT%` is the folder where you installed cmder. After running this command, restart your terminal to load the completion.
17
-
18
15
  ## Remarks
19
16
 
20
17
  This commands updates the list of commands and their options used by command completion in Clink (cmder). You should run this command each time after upgrading the CLI for Microsoft 365.
21
18
 
19
+ !!! important
20
+ Before running this command, change the working directory to where your shell stores completion plugins. For cmder, it's `%CMDER_ROOT%\vendor\clink-completions`, where `%CMDER_ROOT%` is the folder where you installed cmder. After running this command, restart your terminal to load the completion.
21
+
22
22
  ## Examples
23
23
 
24
- Write the list of commands for Clink (cmder) command completion to a file named `m365.lua` in the current directory
24
+ Write the list of commands for Clink (cmder) command completion to a file named `m365.lua` in the current directory.
25
25
 
26
26
  ```powershell
27
27
  m365 cli completion clink update > m365.lua
@@ -118,7 +118,7 @@ m365 onenote page list --webUrl https://contoso.sharepoint.com/sites/testsite
118
118
  === "Markdown"
119
119
 
120
120
  ```md
121
- # onenote page list --userName "mathijs@mathijsdev2.onmicrosoft.com"
121
+ # onenote page list --userName "john.doe@contoso.onmicrosoft.com"
122
122
 
123
123
  Date: 07/01/2023
124
124