@pnp/cli-microsoft365 7.11.0-beta.c513557 → 8.0.0-beta.3c404b8
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.cjs +6 -2
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Auth.js +2 -10
- package/dist/AuthServer.js +10 -10
- package/dist/Command.js +10 -10
- package/dist/chili/chili.js +0 -23
- package/dist/chili/index.js +1 -1
- package/dist/cli/cli.js +12 -74
- package/dist/index.js +1 -1
- package/dist/m365/base/AnonymousCommand.js +1 -1
- package/dist/m365/base/DelegatedGraphCommand.js +2 -2
- package/dist/m365/base/PowerAppsCommand.js +2 -2
- package/dist/m365/base/PowerAutomateCommand.js +2 -2
- package/dist/m365/base/PowerBICommand.js +2 -2
- package/dist/m365/base/PowerPlatformCommand.js +2 -2
- package/dist/m365/base/VivaEngageCommand.js +2 -2
- package/dist/m365/cli/commands/cli-consent.js +1 -1
- package/dist/m365/commands/login.js +1 -1
- package/dist/m365/commands/logout.js +1 -1
- package/dist/m365/commands/setup.js +0 -4
- package/dist/m365/commands/status.js +1 -1
- package/dist/m365/connection/commands/connection-list.js +1 -1
- package/dist/m365/connection/commands/connection-remove.js +1 -1
- package/dist/m365/connection/commands/connection-set.js +1 -1
- package/dist/m365/connection/commands/connection-use.js +1 -1
- package/dist/m365/entra/commands/app/app-permission-add.js +21 -1
- package/dist/m365/entra/commands/app/app-permission-remove.js +17 -0
- package/dist/m365/entra/commands/m365group/m365group-add.js +1 -0
- package/dist/m365/entra/commands/m365group/m365group-set.js +66 -29
- package/dist/m365/entra/commands/m365group/m365group-user-list.js +1 -1
- package/dist/m365/entra/commands/multitenant/MultitenantOrganization.js +2 -0
- package/dist/m365/entra/commands/multitenant/multitenant-get.js +32 -0
- package/dist/m365/entra/commands.js +1 -0
- package/dist/m365/external/commands/connection/connection-doctor.js +11 -25
- package/dist/m365/external/commands/connection/connection-schema-add.js +4 -4
- package/dist/m365/file/commands/file-copy.js +3 -3
- package/dist/m365/flow/commands/flow-list.js +23 -24
- package/dist/m365/graph/commands/subscription/subscription-add.js +4 -2
- package/dist/m365/pa/commands/app/app-export.js +1 -1
- package/dist/m365/pa/commands/app/app-owner-set.js +1 -1
- package/dist/m365/pp/commands/solution/solution-publish.js +1 -1
- package/dist/m365/purview/commands/threatassessment/threatassessment-list.js +1 -1
- package/dist/m365/spfx/commands/project/base-project-command.js +36 -126
- package/dist/m365/spfx/commands/project/project-azuredevops-pipeline-add.js +1 -1
- package/dist/m365/spfx/commands/project/project-externalize.js +1 -1
- package/dist/m365/spfx/commands/project/project-github-workflow-add.js +1 -1
- package/dist/m365/spfx/commands/spfx-doctor.js +4 -4
- package/dist/m365/spo/commands/cdn/cdn-get.js +12 -15
- package/dist/m365/spo/commands/cdn/cdn-set.js +6 -4
- package/dist/m365/spo/commands/commandset/commandset-get.js +1 -1
- package/dist/m365/spo/commands/contenttype/contenttype-field-list.js +124 -0
- package/dist/m365/spo/commands/field/field-list.js +1 -1
- package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +1 -1
- package/dist/m365/spo/commands/group/group-member-add.js +103 -99
- package/dist/m365/spo/commands/group/group-member-remove.js +2 -2
- package/dist/m365/spo/commands/list/list-retentionlabel-ensure.js +1 -1
- package/dist/m365/spo/commands/listitem/listitem-batch-remove.js +1 -1
- package/dist/m365/spo/commands/listitem/listitem-retentionlabel-ensure.js +2 -2
- package/dist/m365/spo/commands/listitem/listitem-retentionlabel-remove.js +2 -2
- package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +2 -3
- package/dist/m365/spo/commands/page/page-text-add.js +2 -3
- package/dist/m365/spo/commands/site/site-commsite-enable.js +1 -1
- package/dist/m365/spo/commands/spo-search.js +4 -5
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-set.js +4 -4
- package/dist/m365/spo/commands/tenant/tenant-commandset-set.js +2 -2
- package/dist/m365/spo/commands/user/user-ensure.js +1 -1
- package/dist/m365/spo/commands.js +1 -0
- package/dist/m365/teams/commands/chat/chat-member-add.js +1 -1
- package/dist/m365/teams/commands/meeting/meeting-attendancereport-get.js +119 -0
- package/dist/m365/teams/commands/meeting/meeting-list.js +1 -1
- package/dist/m365/teams/commands/message/message-remove.js +112 -0
- package/dist/m365/teams/commands.js +2 -0
- package/dist/m365/viva/commands/engage/engage-community-add.js +166 -0
- package/dist/m365/viva/commands/engage/engage-community-get.js +1 -1
- package/dist/m365/viva/commands.js +1 -0
- package/dist/request.js +13 -14
- package/dist/utils/formatting.js +14 -1
- package/dist/utils/spo.js +5 -5
- package/dist/utils/teams.js +49 -0
- package/dist/utils/validation.js +25 -0
- package/docs/docs/cmd/entra/m365group/m365group-set.mdx +37 -7
- package/docs/docs/cmd/entra/multitenant/multitenant-get.mdx +94 -0
- package/docs/docs/cmd/external/connection/connection-doctor.mdx +9 -9
- package/docs/docs/cmd/flow/flow-list.mdx +114 -56
- package/docs/docs/cmd/graph/subscription/subscription-add.mdx +18 -0
- package/docs/docs/cmd/spo/cdn/cdn-set.mdx +3 -3
- package/docs/docs/cmd/spo/contenttype/contenttype-field-list.mdx +172 -0
- package/docs/docs/cmd/spo/contenttype/contenttype-list.mdx +3 -3
- package/docs/docs/cmd/spo/field/field-list.mdx +3 -3
- package/docs/docs/cmd/spo/group/group-member-add.mdx +34 -27
- package/docs/docs/cmd/teams/meeting/meeting-attendancereport-get.mdx +138 -0
- package/docs/docs/cmd/teams/message/message-remove.mdx +63 -0
- package/docs/docs/cmd/viva/engage/engage-community-add.mdx +168 -0
- package/npm-shrinkwrap.json +809 -803
- package/package.json +13 -13
|
@@ -3,12 +3,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
3
3
|
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");
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
|
-
var _SpoGroupMemberAddCommand_instances, _SpoGroupMemberAddCommand_initTelemetry, _SpoGroupMemberAddCommand_initOptions, _SpoGroupMemberAddCommand_initValidators, _SpoGroupMemberAddCommand_initOptionSets;
|
|
6
|
+
var _SpoGroupMemberAddCommand_instances, _SpoGroupMemberAddCommand_initTelemetry, _SpoGroupMemberAddCommand_initOptions, _SpoGroupMemberAddCommand_initValidators, _SpoGroupMemberAddCommand_initOptionSets, _SpoGroupMemberAddCommand_initTypes;
|
|
7
7
|
import request from '../../../../request.js';
|
|
8
8
|
import { entraGroup } from '../../../../utils/entraGroup.js';
|
|
9
|
-
import { entraUser } from '../../../../utils/entraUser.js';
|
|
10
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
11
|
-
import { spo } from '../../../../utils/spo.js';
|
|
12
10
|
import { validation } from '../../../../utils/validation.js';
|
|
13
11
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
14
12
|
import commands from '../../commands.js';
|
|
@@ -20,7 +18,7 @@ class SpoGroupMemberAddCommand extends SpoCommand {
|
|
|
20
18
|
return 'Add members to a SharePoint Group';
|
|
21
19
|
}
|
|
22
20
|
defaultProperties() {
|
|
23
|
-
return ['
|
|
21
|
+
return ['Title', 'UserPrincipalName'];
|
|
24
22
|
}
|
|
25
23
|
constructor() {
|
|
26
24
|
super();
|
|
@@ -29,110 +27,100 @@ class SpoGroupMemberAddCommand extends SpoCommand {
|
|
|
29
27
|
__classPrivateFieldGet(this, _SpoGroupMemberAddCommand_instances, "m", _SpoGroupMemberAddCommand_initOptions).call(this);
|
|
30
28
|
__classPrivateFieldGet(this, _SpoGroupMemberAddCommand_instances, "m", _SpoGroupMemberAddCommand_initValidators).call(this);
|
|
31
29
|
__classPrivateFieldGet(this, _SpoGroupMemberAddCommand_instances, "m", _SpoGroupMemberAddCommand_initOptionSets).call(this);
|
|
30
|
+
__classPrivateFieldGet(this, _SpoGroupMemberAddCommand_instances, "m", _SpoGroupMemberAddCommand_initTypes).call(this);
|
|
32
31
|
}
|
|
33
32
|
async commandAction(logger, args) {
|
|
34
33
|
try {
|
|
35
34
|
if (args.options.aadGroupIds) {
|
|
36
35
|
args.options.entraGroupIds = args.options.aadGroupIds;
|
|
37
|
-
this.warn(logger, `Option 'aadGroupIds' is deprecated. Please use 'entraGroupIds' instead
|
|
36
|
+
await this.warn(logger, `Option 'aadGroupIds' is deprecated. Please use 'entraGroupIds' instead.`);
|
|
38
37
|
}
|
|
39
38
|
if (args.options.aadGroupNames) {
|
|
40
39
|
args.options.entraGroupNames = args.options.aadGroupNames;
|
|
41
|
-
this.warn(logger, `Option 'aadGroupNames' is deprecated. Please use 'entraGroupNames' instead
|
|
40
|
+
await this.warn(logger, `Option 'aadGroupNames' is deprecated. Please use 'entraGroupNames' instead.`);
|
|
42
41
|
}
|
|
43
|
-
const
|
|
44
|
-
|
|
42
|
+
const loginNames = await this.getLoginNames(logger, args.options);
|
|
43
|
+
let apiUrl = `${args.options.webUrl}/_api/web/SiteGroups`;
|
|
44
|
+
if (args.options.groupId) {
|
|
45
|
+
apiUrl += `/GetById(${args.options.groupId})`;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
apiUrl += `/GetByName('${formatting.encodeQueryParameter(args.options.groupName)}')`;
|
|
49
|
+
}
|
|
50
|
+
apiUrl += '/users';
|
|
45
51
|
if (this.verbose) {
|
|
46
|
-
await logger.logToStderr(
|
|
47
|
-
}
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (sharingResult.ErrorMessage !== null) {
|
|
63
|
-
throw sharingResult.ErrorMessage;
|
|
52
|
+
await logger.logToStderr('Adding members to group...');
|
|
53
|
+
}
|
|
54
|
+
const result = [];
|
|
55
|
+
for (const loginName of loginNames) {
|
|
56
|
+
const requestOptions = {
|
|
57
|
+
url: apiUrl,
|
|
58
|
+
headers: {
|
|
59
|
+
accept: 'application/json;odata=nometadata'
|
|
60
|
+
},
|
|
61
|
+
responseType: 'json',
|
|
62
|
+
data: {
|
|
63
|
+
LoginName: loginName
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const response = await request.post(requestOptions);
|
|
67
|
+
result.push(response);
|
|
64
68
|
}
|
|
65
|
-
await logger.log(
|
|
69
|
+
await logger.log(result);
|
|
66
70
|
}
|
|
67
71
|
catch (err) {
|
|
68
72
|
this.handleRejectedODataJsonPromise(err);
|
|
69
73
|
}
|
|
70
74
|
}
|
|
71
|
-
async
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const getGroupMethod = args.options.groupName ?
|
|
76
|
-
`GetByName('${formatting.encodeQueryParameter(args.options.groupName)}')` :
|
|
77
|
-
`GetById('${args.options.groupId}')`;
|
|
78
|
-
const requestOptions = {
|
|
79
|
-
url: `${args.options.webUrl}/_api/web/sitegroups/${getGroupMethod}?$select=Id`,
|
|
80
|
-
headers: {
|
|
81
|
-
'accept': 'application/json;odata=nometadata'
|
|
82
|
-
},
|
|
83
|
-
responseType: 'json'
|
|
84
|
-
};
|
|
85
|
-
const response = await request.get(requestOptions);
|
|
86
|
-
return response.Id;
|
|
87
|
-
}
|
|
88
|
-
async getValidUsers(args, logger) {
|
|
89
|
-
if (this.verbose) {
|
|
90
|
-
await logger.logToStderr('Checking if the specified users and groups exist');
|
|
75
|
+
async getLoginNames(logger, options) {
|
|
76
|
+
const loginNames = [];
|
|
77
|
+
if (options.userNames || options.emails) {
|
|
78
|
+
loginNames.push(...formatting.splitAndTrim(options.userNames || options.emails).map(u => `i:0#.f|membership|${u}`));
|
|
91
79
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
validUserNames.push(spoUserAzureId);
|
|
103
|
-
}
|
|
104
|
-
else if (args.options.userNames) {
|
|
105
|
-
validUserNames.push(trimmedIdentifier);
|
|
106
|
-
}
|
|
107
|
-
else if (args.options.entraGroupIds) {
|
|
108
|
-
validUserNames.push(trimmedIdentifier);
|
|
109
|
-
}
|
|
110
|
-
else if (args.options.entraGroupNames) {
|
|
111
|
-
if (this.verbose) {
|
|
112
|
-
await logger.logToStderr(`Getting ID of Microsoft Entra group ${trimmedIdentifier}`);
|
|
113
|
-
}
|
|
114
|
-
const groupId = await entraGroup.getGroupIdByDisplayName(trimmedIdentifier);
|
|
115
|
-
validUserNames.push(groupId);
|
|
80
|
+
else if (options.entraGroupIds || options.entraGroupNames) {
|
|
81
|
+
if (this.verbose) {
|
|
82
|
+
await logger.logToStderr(`Resolving ${(options.entraGroupIds || options.entraGroupNames).length} group(s)...`);
|
|
83
|
+
}
|
|
84
|
+
const groups = [];
|
|
85
|
+
if (options.entraGroupIds) {
|
|
86
|
+
const groupIds = formatting.splitAndTrim(options.entraGroupIds);
|
|
87
|
+
for (const groupId of groupIds) {
|
|
88
|
+
const group = await entraGroup.getGroupById(groupId);
|
|
89
|
+
groups.push(group);
|
|
116
90
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
const groupNames = formatting.splitAndTrim(options.entraGroupNames);
|
|
94
|
+
for (const groupName of groupNames) {
|
|
95
|
+
const group = await entraGroup.getGroupByDisplayName(groupName);
|
|
96
|
+
groups.push(group);
|
|
123
97
|
}
|
|
124
98
|
}
|
|
125
|
-
|
|
126
|
-
|
|
99
|
+
// Check if group is M365 group or security group
|
|
100
|
+
loginNames.push(...groups.map(g => g.mailEnabled ? `c:0o.c|federateddirectoryclaimprovider|${g.id}` : `c:0t.c|tenant|${g.id}`));
|
|
101
|
+
}
|
|
102
|
+
else if (options.userIds) {
|
|
103
|
+
const userIds = formatting.splitAndTrim(options.userIds);
|
|
104
|
+
if (this.verbose) {
|
|
105
|
+
await logger.logToStderr(`Resolving ${userIds.length} user(s)...`);
|
|
127
106
|
}
|
|
128
|
-
|
|
129
|
-
|
|
107
|
+
for (const userId of userIds) {
|
|
108
|
+
const loginName = await this.getUserLoginNameById(options.webUrl, parseInt(userId));
|
|
109
|
+
loginNames.push(loginName);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return loginNames;
|
|
130
113
|
}
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
114
|
+
async getUserLoginNameById(webUrl, userId) {
|
|
115
|
+
const requestOptions = {
|
|
116
|
+
url: `${webUrl}/_api/web/SiteUsers/GetById(${userId})?$select=LoginName`,
|
|
117
|
+
headers: {
|
|
118
|
+
accept: 'application/json;odata=nometadata'
|
|
119
|
+
},
|
|
120
|
+
responseType: 'json'
|
|
121
|
+
};
|
|
122
|
+
const user = await request.get(requestOptions);
|
|
123
|
+
return user.LoginName;
|
|
136
124
|
}
|
|
137
125
|
}
|
|
138
126
|
_SpoGroupMemberAddCommand_instances = new WeakSet(), _SpoGroupMemberAddCommand_initTelemetry = function _SpoGroupMemberAddCommand_initTelemetry() {
|
|
@@ -177,29 +165,45 @@ _SpoGroupMemberAddCommand_instances = new WeakSet(), _SpoGroupMemberAddCommand_i
|
|
|
177
165
|
if (isValidSharePointUrl !== true) {
|
|
178
166
|
return isValidSharePointUrl;
|
|
179
167
|
}
|
|
180
|
-
if (args.options.groupId &&
|
|
181
|
-
return `Specified groupId ${args.options.groupId} is not a number
|
|
168
|
+
if (args.options.groupId && !validation.isValidPositiveInteger(args.options.groupId)) {
|
|
169
|
+
return `Specified groupId ${args.options.groupId} is not a positive number.`;
|
|
182
170
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
171
|
+
if (args.options.userIds) {
|
|
172
|
+
const isValidArray = validation.isValidPositiveIntegerArray(args.options.userIds);
|
|
173
|
+
if (isValidArray !== true) {
|
|
174
|
+
return `Option 'userIds' contains one or more invalid numbers: ${isValidArray}.`;
|
|
175
|
+
}
|
|
186
176
|
}
|
|
187
|
-
if (args.options.userNames
|
|
188
|
-
|
|
177
|
+
if (args.options.userNames) {
|
|
178
|
+
const isValidArray = validation.isValidUserPrincipalNameArray(args.options.userNames);
|
|
179
|
+
if (isValidArray !== true) {
|
|
180
|
+
return `Option 'userNames' contains one or more invalid UPNs: ${isValidArray}.`;
|
|
181
|
+
}
|
|
189
182
|
}
|
|
190
|
-
if (args.options.emails
|
|
191
|
-
|
|
183
|
+
if (args.options.emails) {
|
|
184
|
+
const isValidArray = validation.isValidUserPrincipalNameArray(args.options.emails);
|
|
185
|
+
if (isValidArray !== true) {
|
|
186
|
+
return `Option 'emails' contains one or more invalid UPNs: ${isValidArray}.`;
|
|
187
|
+
}
|
|
192
188
|
}
|
|
193
|
-
if (args.options.entraGroupIds
|
|
194
|
-
|
|
189
|
+
if (args.options.entraGroupIds) {
|
|
190
|
+
const isValidArray = validation.isValidGuidArray(args.options.entraGroupIds);
|
|
191
|
+
if (isValidArray !== true) {
|
|
192
|
+
return `Option 'entraGroupIds' contains one or more invalid GUIDs: ${isValidArray}.`;
|
|
193
|
+
}
|
|
195
194
|
}
|
|
196
|
-
if (args.options.aadGroupIds
|
|
197
|
-
|
|
195
|
+
if (args.options.aadGroupIds) {
|
|
196
|
+
const isValidArray = validation.isValidGuidArray(args.options.aadGroupIds);
|
|
197
|
+
if (isValidArray !== true) {
|
|
198
|
+
return `Option 'aadGroupIds' contains one or more invalid GUIDs: ${isValidArray}.`;
|
|
199
|
+
}
|
|
198
200
|
}
|
|
199
201
|
return true;
|
|
200
202
|
});
|
|
201
203
|
}, _SpoGroupMemberAddCommand_initOptionSets = function _SpoGroupMemberAddCommand_initOptionSets() {
|
|
202
204
|
this.optionSets.push({ options: ['groupId', 'groupName'] }, { options: ['userNames', 'emails', 'userIds', 'entraGroupIds', 'aadGroupIds', 'entraGroupNames', 'aadGroupNames'] });
|
|
205
|
+
}, _SpoGroupMemberAddCommand_initTypes = function _SpoGroupMemberAddCommand_initTypes() {
|
|
206
|
+
this.types.string.push('webUrl', 'groupName', 'userNames', 'emails', 'userIds', 'entraGroupIds', 'aadGroupIds', 'entraGroupNames', 'aadGroupNames');
|
|
203
207
|
};
|
|
204
208
|
export default new SpoGroupMemberAddCommand();
|
|
205
209
|
//# sourceMappingURL=group-member-add.js.map
|
|
@@ -47,11 +47,11 @@ class SpoGroupMemberRemoveCommand extends SpoCommand {
|
|
|
47
47
|
async commandAction(logger, args) {
|
|
48
48
|
if (args.options.aadGroupId) {
|
|
49
49
|
args.options.entraGroupId = args.options.aadGroupId;
|
|
50
|
-
this.warn(logger, `Option 'aadGroupId' is deprecated. Please use 'entraGroupId' instead`);
|
|
50
|
+
await this.warn(logger, `Option 'aadGroupId' is deprecated. Please use 'entraGroupId' instead`);
|
|
51
51
|
}
|
|
52
52
|
if (args.options.aadGroupName) {
|
|
53
53
|
args.options.entraGroupName = args.options.aadGroupName;
|
|
54
|
-
this.warn(logger, `Option 'aadGroupName' is deprecated. Please use 'entraGroupName' instead`);
|
|
54
|
+
await this.warn(logger, `Option 'aadGroupName' is deprecated. Please use 'entraGroupName' instead`);
|
|
55
55
|
}
|
|
56
56
|
if (args.options.force) {
|
|
57
57
|
if (this.debug) {
|
|
@@ -38,7 +38,7 @@ class SpoListRetentionLabelEnsureCommand extends SpoCommand {
|
|
|
38
38
|
}
|
|
39
39
|
async getListServerRelativeUrl(args, logger) {
|
|
40
40
|
if (this.verbose) {
|
|
41
|
-
logger.logToStderr('Getting the list server relative URL');
|
|
41
|
+
await logger.logToStderr('Getting the list server relative URL');
|
|
42
42
|
}
|
|
43
43
|
if (args.options.listUrl) {
|
|
44
44
|
return urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
@@ -34,7 +34,7 @@ class SpoListItemBatchRemoveCommand extends SpoCommand {
|
|
|
34
34
|
const removeListItems = async () => {
|
|
35
35
|
try {
|
|
36
36
|
if (this.verbose) {
|
|
37
|
-
logger.logToStderr('Removing the listitems from SharePoint...');
|
|
37
|
+
await logger.logToStderr('Removing the listitems from SharePoint...');
|
|
38
38
|
}
|
|
39
39
|
let idsToRemove = [];
|
|
40
40
|
if (args.options.filePath) {
|
|
@@ -46,7 +46,7 @@ class SpoListItemRetentionLabelEnsureCommand extends SpoCommand {
|
|
|
46
46
|
return options.name;
|
|
47
47
|
}
|
|
48
48
|
if (this.verbose) {
|
|
49
|
-
logger.logToStderr(`Retrieving the name of the retention label based on the Id '${options.id}'...`);
|
|
49
|
+
await logger.logToStderr(`Retrieving the name of the retention label based on the Id '${options.id}'...`);
|
|
50
50
|
}
|
|
51
51
|
const requestUrl = `${options.webUrl}/_api/SP.CompliancePolicy.SPPolicyStoreProxy.GetAvailableTagsForSite(siteUrl=@a1)?@a1='${formatting.encodeQueryParameter(options.webUrl)}'`;
|
|
52
52
|
const labels = await odata.getAllItems(requestUrl);
|
|
@@ -87,7 +87,7 @@ class SpoListItemRetentionLabelEnsureCommand extends SpoCommand {
|
|
|
87
87
|
const serverRelativePath = urlUtil.getServerRelativePath(options.webUrl, response.RootFolder.ServerRelativeUrl);
|
|
88
88
|
const listAbsoluteUrl = urlUtil.urlCombine(tenantUrl, serverRelativePath);
|
|
89
89
|
if (this.verbose) {
|
|
90
|
-
logger.logToStderr(`List absolute URL found: '${listAbsoluteUrl}'`);
|
|
90
|
+
await logger.logToStderr(`List absolute URL found: '${listAbsoluteUrl}'`);
|
|
91
91
|
}
|
|
92
92
|
return listAbsoluteUrl;
|
|
93
93
|
}
|
|
@@ -56,7 +56,7 @@ class SpoListItemRetentionLabelRemoveCommand extends SpoCommand {
|
|
|
56
56
|
return urlUtil.urlCombine(tenantUrl, serverRelativePath);
|
|
57
57
|
}
|
|
58
58
|
if (this.verbose) {
|
|
59
|
-
logger.logToStderr(`Retrieving list absolute URL...`);
|
|
59
|
+
await logger.logToStderr(`Retrieving list absolute URL...`);
|
|
60
60
|
}
|
|
61
61
|
let requestUrl = `${options.webUrl}/_api/web`;
|
|
62
62
|
if (options.listId) {
|
|
@@ -76,7 +76,7 @@ class SpoListItemRetentionLabelRemoveCommand extends SpoCommand {
|
|
|
76
76
|
const serverRelativePath = urlUtil.getServerRelativePath(options.webUrl, response.RootFolder.ServerRelativeUrl);
|
|
77
77
|
const listAbsoluteUrl = urlUtil.urlCombine(tenantUrl, serverRelativePath);
|
|
78
78
|
if (this.verbose) {
|
|
79
|
-
logger.logToStderr(`List absolute URL found: '${listAbsoluteUrl}'`);
|
|
79
|
+
await logger.logToStderr(`List absolute URL found: '${listAbsoluteUrl}'`);
|
|
80
80
|
}
|
|
81
81
|
return listAbsoluteUrl;
|
|
82
82
|
}
|
|
@@ -4,7 +4,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _SpoPageClientSideWebPartAddCommand_instances, _SpoPageClientSideWebPartAddCommand_initTelemetry, _SpoPageClientSideWebPartAddCommand_initOptions, _SpoPageClientSideWebPartAddCommand_initValidators, _SpoPageClientSideWebPartAddCommand_initOptionSets;
|
|
7
|
-
import { isNumber } from 'util';
|
|
8
7
|
import { v4 } from 'uuid';
|
|
9
8
|
import request from '../../../../request.js';
|
|
10
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
@@ -370,10 +369,10 @@ _SpoPageClientSideWebPartAddCommand_instances = new WeakSet(), _SpoPageClientSid
|
|
|
370
369
|
.webPartData}. Error: ${e}`;
|
|
371
370
|
}
|
|
372
371
|
}
|
|
373
|
-
if (args.options.section && (!
|
|
372
|
+
if (args.options.section && (!Number.isInteger(args.options.section) || args.options.section < 1)) {
|
|
374
373
|
return 'The value of parameter section must be 1 or higher';
|
|
375
374
|
}
|
|
376
|
-
if (args.options.column && (!
|
|
375
|
+
if (args.options.column && (!Number.isInteger(args.options.column) || args.options.column < 1)) {
|
|
377
376
|
return 'The value of parameter column must be 1 or higher';
|
|
378
377
|
}
|
|
379
378
|
return validation.isValidSharePointUrl(args.options.webUrl);
|
|
@@ -4,7 +4,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _SpoPageTextAddCommand_instances, _SpoPageTextAddCommand_initTelemetry, _SpoPageTextAddCommand_initOptions, _SpoPageTextAddCommand_initValidators;
|
|
7
|
-
import { isNumber } from 'util';
|
|
8
7
|
import request from '../../../../request.js';
|
|
9
8
|
import { spo } from '../../../../utils/spo.js';
|
|
10
9
|
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
@@ -119,10 +118,10 @@ _SpoPageTextAddCommand_instances = new WeakSet(), _SpoPageTextAddCommand_initTel
|
|
|
119
118
|
});
|
|
120
119
|
}, _SpoPageTextAddCommand_initValidators = function _SpoPageTextAddCommand_initValidators() {
|
|
121
120
|
this.validators.push(async (args) => {
|
|
122
|
-
if (args.options.section && (!
|
|
121
|
+
if (args.options.section && (!Number.isInteger(args.options.section) || args.options.section < 1)) {
|
|
123
122
|
return 'The value of parameter section must be 1 or higher';
|
|
124
123
|
}
|
|
125
|
-
if (args.options.column && (!
|
|
124
|
+
if (args.options.column && (!Number.isInteger(args.options.column) || args.options.column < 1)) {
|
|
126
125
|
return 'The value of parameter column must be 1 or higher';
|
|
127
126
|
}
|
|
128
127
|
return validation.isValidSharePointUrl(args.options.webUrl);
|
|
@@ -26,7 +26,7 @@ class SpoSiteCommSiteEnableCommand extends SpoCommand {
|
|
|
26
26
|
async commandAction(logger, args) {
|
|
27
27
|
const designPackageId = this.getDesignPackageId(args.options);
|
|
28
28
|
if (this.verbose) {
|
|
29
|
-
logger.logToStderr(`Enabling communication site with design package '${designPackageId}' at '${args.options.url}'...`);
|
|
29
|
+
await logger.logToStderr(`Enabling communication site with design package '${designPackageId}' at '${args.options.url}'...`);
|
|
30
30
|
}
|
|
31
31
|
try {
|
|
32
32
|
const requestOptions = {
|
|
@@ -4,7 +4,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _SpoSearchCommand_instances, _SpoSearchCommand_initTelemetry, _SpoSearchCommand_initOptions, _SpoSearchCommand_initValidators;
|
|
7
|
-
import { isNumber } from 'util';
|
|
8
7
|
import { cli } from '../../../cli/cli.js';
|
|
9
8
|
import request from '../../../request.js';
|
|
10
9
|
import { formatting } from '../../../utils/formatting.js';
|
|
@@ -39,7 +38,7 @@ class SpoSearchCommand extends SpoCommand {
|
|
|
39
38
|
await logger.logToStderr(`Executing search query '${args.options.queryText}' on site at ${webUrl}...`);
|
|
40
39
|
}
|
|
41
40
|
const results = await this.executeSearchQuery(logger, args, webUrl, []);
|
|
42
|
-
this.printResults(logger, args, results);
|
|
41
|
+
await this.printResults(logger, args, results);
|
|
43
42
|
}
|
|
44
43
|
catch (err) {
|
|
45
44
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -266,16 +265,16 @@ _SpoSearchCommand_instances = new WeakSet(), _SpoSearchCommand_initTelemetry = f
|
|
|
266
265
|
if (args.options.sortList && !/^([a-z0-9_]+:(ascending|descending))(,([a-z0-9_]+:(ascending|descending)))*$/gi.test(args.options.sortList)) {
|
|
267
266
|
return `sortlist parameter value '${args.options.sortList}' does not match the required pattern (=comma-separated list of '<property>:(ascending|descending)'-pattern)`;
|
|
268
267
|
}
|
|
269
|
-
if (args.options.rowLimit && !
|
|
268
|
+
if (args.options.rowLimit && !Number.isInteger(args.options.rowLimit)) {
|
|
270
269
|
return `${args.options.rowLimit} is not a valid number`;
|
|
271
270
|
}
|
|
272
|
-
if (args.options.startRow && !
|
|
271
|
+
if (args.options.startRow && !Number.isInteger(args.options.startRow)) {
|
|
273
272
|
return `${args.options.startRow} is not a valid number`;
|
|
274
273
|
}
|
|
275
274
|
if (args.options.startRow && args.options.allResults) {
|
|
276
275
|
return 'You cannot specify startRow when allResults is set';
|
|
277
276
|
}
|
|
278
|
-
if (args.options.culture && !
|
|
277
|
+
if (args.options.culture && !Number.isInteger(args.options.culture)) {
|
|
279
278
|
return `${args.options.culture} is not a valid number`;
|
|
280
279
|
}
|
|
281
280
|
return true;
|
|
@@ -76,7 +76,7 @@ class SpoTenantApplicationCustomizerSetCommand extends SpoCommand {
|
|
|
76
76
|
}
|
|
77
77
|
async getComponentManifest(appCatalogUrl, clientSideComponentId, logger) {
|
|
78
78
|
if (this.verbose) {
|
|
79
|
-
logger.logToStderr('Retrieving component manifest item from the ComponentManifests list on the app catalog site so that we get the solution id');
|
|
79
|
+
await logger.logToStderr('Retrieving component manifest item from the ComponentManifests list on the app catalog site so that we get the solution id');
|
|
80
80
|
}
|
|
81
81
|
const camlQuery = `<View><ViewFields><FieldRef Name='ClientComponentId'></FieldRef><FieldRef Name='SolutionId'></FieldRef><FieldRef Name='ClientComponentManifest'></FieldRef></ViewFields><Query><Where><Eq><FieldRef Name='ClientComponentId' /><Value Type='Guid'>${clientSideComponentId}</Value></Eq></Where></Query></View>`;
|
|
82
82
|
const commandOptions = {
|
|
@@ -89,7 +89,7 @@ class SpoTenantApplicationCustomizerSetCommand extends SpoCommand {
|
|
|
89
89
|
};
|
|
90
90
|
const output = await cli.executeCommandWithOutput(spoListItemListCommand, { options: { ...commandOptions, _: [] } });
|
|
91
91
|
if (this.verbose) {
|
|
92
|
-
logger.logToStderr(output.stderr);
|
|
92
|
+
await logger.logToStderr(output.stderr);
|
|
93
93
|
}
|
|
94
94
|
const outputParsed = JSON.parse(output.stdout);
|
|
95
95
|
if (outputParsed.length === 0) {
|
|
@@ -99,7 +99,7 @@ class SpoTenantApplicationCustomizerSetCommand extends SpoCommand {
|
|
|
99
99
|
}
|
|
100
100
|
async getSolutionFromAppCatalog(appCatalogUrl, solutionId, logger) {
|
|
101
101
|
if (this.verbose) {
|
|
102
|
-
logger.logToStderr(`Retrieving solution with id ${solutionId} from the application catalog`);
|
|
102
|
+
await logger.logToStderr(`Retrieving solution with id ${solutionId} from the application catalog`);
|
|
103
103
|
}
|
|
104
104
|
const camlQuery = `<View><ViewFields><FieldRef Name='SkipFeatureDeployment'></FieldRef><FieldRef Name='ContainsTenantWideExtension'></FieldRef></ViewFields><Query><Where><Eq><FieldRef Name='AppProductID' /><Value Type='Guid'>${solutionId}</Value></Eq></Where></Query></View>`;
|
|
105
105
|
const commandOptions = {
|
|
@@ -112,7 +112,7 @@ class SpoTenantApplicationCustomizerSetCommand extends SpoCommand {
|
|
|
112
112
|
};
|
|
113
113
|
const output = await cli.executeCommandWithOutput(spoListItemListCommand, { options: { ...commandOptions, _: [] } });
|
|
114
114
|
if (this.verbose) {
|
|
115
|
-
logger.logToStderr(output.stderr);
|
|
115
|
+
await logger.logToStderr(output.stderr);
|
|
116
116
|
}
|
|
117
117
|
const outputParsed = JSON.parse(output.stdout);
|
|
118
118
|
if (outputParsed.length === 0) {
|
|
@@ -44,7 +44,7 @@ class SpoTenantCommandSetSetCommand extends SpoCommand {
|
|
|
44
44
|
}
|
|
45
45
|
async getListItemById(logger, webUrl, listServerRelativeUrl, id) {
|
|
46
46
|
if (this.verbose) {
|
|
47
|
-
logger.logToStderr(`Getting the list item by id ${id}`);
|
|
47
|
+
await logger.logToStderr(`Getting the list item by id ${id}`);
|
|
48
48
|
}
|
|
49
49
|
const reqOptions = {
|
|
50
50
|
url: `${webUrl}/_api/web/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')/Items(${id})`,
|
|
@@ -57,7 +57,7 @@ class SpoTenantCommandSetSetCommand extends SpoCommand {
|
|
|
57
57
|
}
|
|
58
58
|
async updateTenantWideExtension(appCatalogUrl, options, listServerRelativeUrl, logger) {
|
|
59
59
|
if (this.verbose) {
|
|
60
|
-
logger.logToStderr('Updating tenant wide extension to the TenantWideExtensions list');
|
|
60
|
+
await logger.logToStderr('Updating tenant wide extension to the TenantWideExtensions list');
|
|
61
61
|
}
|
|
62
62
|
const formValues = [];
|
|
63
63
|
if (options.newTitle !== undefined) {
|
|
@@ -27,7 +27,7 @@ class SpoUserEnsureCommand extends SpoCommand {
|
|
|
27
27
|
async commandAction(logger, args) {
|
|
28
28
|
if (args.options.aadId) {
|
|
29
29
|
args.options.entraId = args.options.aadId;
|
|
30
|
-
this.warn(logger, `Option 'aadId' is deprecated. Please use 'entraId' instead`);
|
|
30
|
+
await this.warn(logger, `Option 'aadId' is deprecated. Please use 'entraId' instead`);
|
|
31
31
|
}
|
|
32
32
|
if (this.verbose) {
|
|
33
33
|
await logger.logToStderr(`Ensuring user ${args.options.entraId || args.options.userName} at site ${args.options.webUrl}`);
|
|
@@ -31,6 +31,7 @@ export default {
|
|
|
31
31
|
COMMANDSET_REMOVE: `${prefix} commandset remove`,
|
|
32
32
|
COMMANDSET_SET: `${prefix} commandset set`,
|
|
33
33
|
CONTENTTYPE_ADD: `${prefix} contenttype add`,
|
|
34
|
+
CONTENTTYPE_FIELD_LIST: `${prefix} contenttype field list`,
|
|
34
35
|
CONTENTTYPE_FIELD_REMOVE: `${prefix} contenttype field remove`,
|
|
35
36
|
CONTENTTYPE_FIELD_SET: `${prefix} contenttype field set`,
|
|
36
37
|
CONTENTTYPE_GET: `${prefix} contenttype get`,
|
|
@@ -27,7 +27,7 @@ class TeamsChatMemberAddCommand extends GraphCommand {
|
|
|
27
27
|
async commandAction(logger, args) {
|
|
28
28
|
try {
|
|
29
29
|
if (this.verbose) {
|
|
30
|
-
logger.logToStderr(`Adding member ${args.options.userId || args.options.userName} to chat with id ${args.options.chatId}...`);
|
|
30
|
+
await logger.logToStderr(`Adding member ${args.options.userId || args.options.userName} to chat with id ${args.options.chatId}...`);
|
|
31
31
|
}
|
|
32
32
|
const chatMemberAddOptions = {
|
|
33
33
|
url: `${this.resource}/v1.0/chats/${args.options.chatId}/members`,
|