@pnp/cli-microsoft365 7.11.0-beta.c513557 → 8.0.0-beta.b0e3dab
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 +5 -2
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Auth.js +1 -1
- package/dist/AuthServer.js +10 -10
- package/dist/Command.js +10 -10
- package/dist/chili/index.js +1 -1
- package/dist/cli/cli.js +11 -11
- 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/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-user-list.js +1 -1
- package/dist/m365/external/commands/connection/connection-doctor.js +1 -1
- 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 +21 -23
- 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/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/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/site/site-commsite-enable.js +1 -1
- package/dist/m365/spo/commands/spo-search.js +1 -1
- 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/teams/commands/chat/chat-member-add.js +1 -1
- package/dist/m365/teams/commands/meeting/meeting-list.js +1 -1
- package/dist/m365/viva/commands/engage/engage-community-get.js +1 -1
- package/dist/request.js +13 -14
- package/dist/utils/spo.js +5 -5
- package/dist/utils/validation.js +25 -0
- package/docs/docs/cmd/flow/flow-list.mdx +114 -56
- package/docs/docs/cmd/spo/cdn/cdn-set.mdx +3 -3
- package/docs/docs/cmd/spo/group/group-member-add.mdx +34 -27
- package/npm-shrinkwrap.json +802 -601
- package/package.json +12 -12
|
@@ -26,7 +26,7 @@ class PaAppOwnerSetCommand extends PowerAppsCommand {
|
|
|
26
26
|
}
|
|
27
27
|
async commandAction(logger, args) {
|
|
28
28
|
if (this.verbose) {
|
|
29
|
-
logger.logToStderr(`Setting new owner ${args.options.userId || args.options.userName} for Power Apps app ${args.options.appName}...`);
|
|
29
|
+
await logger.logToStderr(`Setting new owner ${args.options.userId || args.options.userName} for Power Apps app ${args.options.appName}...`);
|
|
30
30
|
}
|
|
31
31
|
try {
|
|
32
32
|
const userId = await this.getUserId(args.options);
|
|
@@ -26,7 +26,7 @@ class PurviewThreatAssessmentListCommand extends GraphCommand {
|
|
|
26
26
|
}
|
|
27
27
|
async commandAction(logger, args) {
|
|
28
28
|
if (this.verbose) {
|
|
29
|
-
logger.logToStderr('Retrieving a list of threat assessments');
|
|
29
|
+
await logger.logToStderr('Retrieving a list of threat assessments');
|
|
30
30
|
}
|
|
31
31
|
try {
|
|
32
32
|
const filter = this.getFilterQuery(args.options);
|
|
@@ -37,7 +37,7 @@ class SpfxProjectAzureDevOpsPipelineAddCommand extends BaseProjectCommand {
|
|
|
37
37
|
const packageJson = fs.readFileSync(solutionPackageJsonFile, 'utf-8');
|
|
38
38
|
const solutionName = JSON.parse(packageJson).name;
|
|
39
39
|
if (this.debug) {
|
|
40
|
-
logger.logToStderr(`Adding Azure DevOps pipeline in the current SPFx project`);
|
|
40
|
+
await logger.logToStderr(`Adding Azure DevOps pipeline in the current SPFx project`);
|
|
41
41
|
}
|
|
42
42
|
try {
|
|
43
43
|
this.updatePipeline(solutionName, pipeline, args.options);
|
|
@@ -81,7 +81,7 @@ class SpfxProjectExternalizeCommand extends BaseProjectCommand {
|
|
|
81
81
|
this.allEditSuggestions.push(...rulesResults.map(x => x.suggestions).reduce((x, y) => [...x, ...y]));
|
|
82
82
|
//removing duplicates
|
|
83
83
|
this.allFindings = this.allFindings.filter((x, i) => this.allFindings.findIndex(y => y.key === x.key) === i);
|
|
84
|
-
this.writeReport(this.allFindings, this.allEditSuggestions, logger, args.options);
|
|
84
|
+
await this.writeReport(this.allFindings, this.allEditSuggestions, logger, args.options);
|
|
85
85
|
}
|
|
86
86
|
catch (err) {
|
|
87
87
|
throw new CommandError(err);
|
|
@@ -40,7 +40,7 @@ class SpfxProjectGithubWorkflowAddCommand extends BaseProjectCommand {
|
|
|
40
40
|
const packageJson = fs.readFileSync(solutionPackageJsonFile, 'utf-8');
|
|
41
41
|
const solutionName = JSON.parse(packageJson).name;
|
|
42
42
|
if (this.debug) {
|
|
43
|
-
logger.logToStderr(`Adding GitHub workflow in the current SPFx project`);
|
|
43
|
+
await logger.logToStderr(`Adding GitHub workflow in the current SPFx project`);
|
|
44
44
|
}
|
|
45
45
|
try {
|
|
46
46
|
this.updateWorkflow(solutionName, workflow, args.options);
|
|
@@ -713,7 +713,7 @@ class SpfxDoctorCommand extends BaseProjectCommand {
|
|
|
713
713
|
}
|
|
714
714
|
async checkNodeVersion(prerequisites) {
|
|
715
715
|
const nodeVersion = this.getNodeVersion();
|
|
716
|
-
this.checkStatus('Node', nodeVersion, prerequisites.node);
|
|
716
|
+
await this.checkStatus('Node', nodeVersion, prerequisites.node);
|
|
717
717
|
}
|
|
718
718
|
async checkSharePointFrameworkVersion(spfxVersionRequested) {
|
|
719
719
|
let spfxVersionDetected = await this.getSPFxVersionFromYoRcFile();
|
|
@@ -725,7 +725,7 @@ class SpfxDoctorCommand extends BaseProjectCommand {
|
|
|
725
725
|
fix: `npm i -g @microsoft/generator-sharepoint@${spfxVersionRequested}`
|
|
726
726
|
};
|
|
727
727
|
if (spfxVersionDetected) {
|
|
728
|
-
this.checkStatus(`SharePoint Framework`, spfxVersionDetected, versionCheck);
|
|
728
|
+
await this.checkStatus(`SharePoint Framework`, spfxVersionDetected, versionCheck);
|
|
729
729
|
}
|
|
730
730
|
else {
|
|
731
731
|
const message = `SharePoint Framework v${spfxVersionRequested} not found`;
|
|
@@ -742,7 +742,7 @@ class SpfxDoctorCommand extends BaseProjectCommand {
|
|
|
742
742
|
async checkYo(prerequisites) {
|
|
743
743
|
const yoVersion = await this.getPackageVersion('yo', PackageSearchMode.GlobalOnly, HandlePromise.Continue);
|
|
744
744
|
if (yoVersion) {
|
|
745
|
-
this.checkStatus('yo', yoVersion, prerequisites.yo);
|
|
745
|
+
await this.checkStatus('yo', yoVersion, prerequisites.yo);
|
|
746
746
|
}
|
|
747
747
|
else {
|
|
748
748
|
const message = 'yo not found';
|
|
@@ -758,7 +758,7 @@ class SpfxDoctorCommand extends BaseProjectCommand {
|
|
|
758
758
|
async checkGulpCli(prerequisites) {
|
|
759
759
|
const gulpCliVersion = await this.getPackageVersion('gulp-cli', PackageSearchMode.GlobalOnly, HandlePromise.Continue);
|
|
760
760
|
if (gulpCliVersion) {
|
|
761
|
-
this.checkStatus('gulp-cli', gulpCliVersion, prerequisites.gulpCli);
|
|
761
|
+
await this.checkStatus('gulp-cli', gulpCliVersion, prerequisites.gulpCli);
|
|
762
762
|
}
|
|
763
763
|
else {
|
|
764
764
|
const message = 'gulp-cli not found';
|
|
@@ -3,7 +3,7 @@ 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 _SpoCdnGetCommand_instances, _SpoCdnGetCommand_initTelemetry, _SpoCdnGetCommand_initOptions, _SpoCdnGetCommand_initValidators;
|
|
6
|
+
var _SpoCdnGetCommand_instances, _SpoCdnGetCommand_initTelemetry, _SpoCdnGetCommand_initOptions, _SpoCdnGetCommand_initValidators, _SpoCdnGetCommand_initTypes;
|
|
7
7
|
import config from '../../../../config.js';
|
|
8
8
|
import request from '../../../../request.js';
|
|
9
9
|
import { spo } from '../../../../utils/spo.js';
|
|
@@ -19,9 +19,11 @@ class SpoCdnGetCommand extends SpoCommand {
|
|
|
19
19
|
constructor() {
|
|
20
20
|
super();
|
|
21
21
|
_SpoCdnGetCommand_instances.add(this);
|
|
22
|
+
this.validTypes = ['Public', 'Private'];
|
|
22
23
|
__classPrivateFieldGet(this, _SpoCdnGetCommand_instances, "m", _SpoCdnGetCommand_initTelemetry).call(this);
|
|
23
24
|
__classPrivateFieldGet(this, _SpoCdnGetCommand_instances, "m", _SpoCdnGetCommand_initOptions).call(this);
|
|
24
25
|
__classPrivateFieldGet(this, _SpoCdnGetCommand_instances, "m", _SpoCdnGetCommand_initValidators).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoCdnGetCommand_instances, "m", _SpoCdnGetCommand_initTypes).call(this);
|
|
25
27
|
}
|
|
26
28
|
async commandAction(logger, args) {
|
|
27
29
|
const cdnTypeString = args.options.type || 'Public';
|
|
@@ -48,15 +50,11 @@ class SpoCdnGetCommand extends SpoCommand {
|
|
|
48
50
|
if (response.ErrorInfo) {
|
|
49
51
|
throw response.ErrorInfo.ErrorMessage;
|
|
50
52
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
await logger.logToStderr(`${(cdnType === 0 ? 'Public' : 'Private')} CDN at ${spoAdminUrl} is ${(result === true ? 'enabled' : 'disabled')}`);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
await logger.logToStderr(result);
|
|
58
|
-
}
|
|
53
|
+
const result = json[json.length - 1];
|
|
54
|
+
if (this.verbose) {
|
|
55
|
+
await logger.logToStderr(`${cdnType === 0 ? 'Public' : 'Private'} CDN at ${spoAdminUrl} is ${result === true ? 'enabled' : 'disabled'}`);
|
|
59
56
|
}
|
|
57
|
+
await logger.log(result);
|
|
60
58
|
}
|
|
61
59
|
catch (err) {
|
|
62
60
|
this.handleRejectedPromise(err);
|
|
@@ -72,18 +70,17 @@ _SpoCdnGetCommand_instances = new WeakSet(), _SpoCdnGetCommand_initTelemetry = f
|
|
|
72
70
|
}, _SpoCdnGetCommand_initOptions = function _SpoCdnGetCommand_initOptions() {
|
|
73
71
|
this.options.unshift({
|
|
74
72
|
option: '-t, --type [type]',
|
|
75
|
-
autocomplete:
|
|
73
|
+
autocomplete: this.validTypes
|
|
76
74
|
});
|
|
77
75
|
}, _SpoCdnGetCommand_initValidators = function _SpoCdnGetCommand_initValidators() {
|
|
78
76
|
this.validators.push(async (args) => {
|
|
79
|
-
if (args.options.type) {
|
|
80
|
-
|
|
81
|
-
args.options.type !== 'Private') {
|
|
82
|
-
return `${args.options.type} is not a valid CDN type. Allowed values are Public|Private`;
|
|
83
|
-
}
|
|
77
|
+
if (args.options.type && !this.validTypes.includes(args.options.type)) {
|
|
78
|
+
return `'${args.options.type}' is not a valid CDN type. Allowed values are: ${this.validTypes.join(', ')}.`;
|
|
84
79
|
}
|
|
85
80
|
return true;
|
|
86
81
|
});
|
|
82
|
+
}, _SpoCdnGetCommand_initTypes = function _SpoCdnGetCommand_initTypes() {
|
|
83
|
+
this.types.string.push('type');
|
|
87
84
|
};
|
|
88
85
|
export default new SpoCdnGetCommand();
|
|
89
86
|
//# sourceMappingURL=cdn-get.js.map
|
|
@@ -19,6 +19,7 @@ class SpoCdnSetCommand extends SpoCommand {
|
|
|
19
19
|
constructor() {
|
|
20
20
|
super();
|
|
21
21
|
_SpoCdnSetCommand_instances.add(this);
|
|
22
|
+
this.validTypes = ['Public', 'Private', 'Both'];
|
|
22
23
|
__classPrivateFieldGet(this, _SpoCdnSetCommand_instances, "m", _SpoCdnSetCommand_initTelemetry).call(this);
|
|
23
24
|
__classPrivateFieldGet(this, _SpoCdnSetCommand_instances, "m", _SpoCdnSetCommand_initOptions).call(this);
|
|
24
25
|
__classPrivateFieldGet(this, _SpoCdnSetCommand_instances, "m", _SpoCdnSetCommand_initTypes).call(this);
|
|
@@ -104,7 +105,7 @@ _SpoCdnSetCommand_instances = new WeakSet(), _SpoCdnSetCommand_initTelemetry = f
|
|
|
104
105
|
Object.assign(this.telemetryProperties, {
|
|
105
106
|
cdnType: args.options.type || 'Public',
|
|
106
107
|
enabled: args.options.enabled,
|
|
107
|
-
noDefaultOrigins:
|
|
108
|
+
noDefaultOrigins: !!args.options.noDefaultOrigins
|
|
108
109
|
});
|
|
109
110
|
});
|
|
110
111
|
}, _SpoCdnSetCommand_initOptions = function _SpoCdnSetCommand_initOptions() {
|
|
@@ -113,18 +114,19 @@ _SpoCdnSetCommand_instances = new WeakSet(), _SpoCdnSetCommand_initTelemetry = f
|
|
|
113
114
|
autocomplete: ['true', 'false']
|
|
114
115
|
}, {
|
|
115
116
|
option: '-t, --type [type]',
|
|
116
|
-
autocomplete:
|
|
117
|
+
autocomplete: this.validTypes
|
|
117
118
|
}, {
|
|
118
119
|
option: '--noDefaultOrigins'
|
|
119
120
|
});
|
|
120
121
|
}, _SpoCdnSetCommand_initTypes = function _SpoCdnSetCommand_initTypes() {
|
|
121
|
-
this.types.boolean.push('enabled');
|
|
122
|
+
this.types.boolean.push('enabled', 'noDefaultOrigins');
|
|
123
|
+
this.types.string.push('type');
|
|
122
124
|
}, _SpoCdnSetCommand_initValidators = function _SpoCdnSetCommand_initValidators() {
|
|
123
125
|
this.validators.push(async (args) => {
|
|
124
126
|
if (args.options.type) {
|
|
125
127
|
if (args.options.type !== 'Public' && args.options.type !== 'Both' &&
|
|
126
128
|
args.options.type !== 'Private') {
|
|
127
|
-
return `${args.options.type} is not a valid CDN type. Allowed values are
|
|
129
|
+
return `${args.options.type} is not a valid CDN type. Allowed values are ${this.validTypes.join(', ')}.`;
|
|
128
130
|
}
|
|
129
131
|
}
|
|
130
132
|
return true;
|
|
@@ -60,7 +60,7 @@ class SpoCommandSetGetCommand extends SpoCommand {
|
|
|
60
60
|
else {
|
|
61
61
|
const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id', commandSets);
|
|
62
62
|
const commandSet = await cli.handleMultipleResultsFound(`Multiple command sets with title '${args.options.title}' found.`, resultAsKeyValuePair);
|
|
63
|
-
logger.log(commandSet);
|
|
63
|
+
await logger.log(commandSet);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -54,7 +54,7 @@ class SpoFileRetentionLabelRemoveCommand extends SpoCommand {
|
|
|
54
54
|
}
|
|
55
55
|
async getFileProperties(logger, args) {
|
|
56
56
|
if (this.verbose) {
|
|
57
|
-
logger.logToStderr(`Retrieving list and item information for file '${args.options.fileId || args.options.fileUrl}' in site at ${args.options.webUrl}...`);
|
|
57
|
+
await logger.logToStderr(`Retrieving list and item information for file '${args.options.fileId || args.options.fileUrl}' in site at ${args.options.webUrl}...`);
|
|
58
58
|
}
|
|
59
59
|
let requestUrl = `${args.options.webUrl}/_api/web/`;
|
|
60
60
|
if (args.options.fileId) {
|
|
@@ -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
|
}
|
|
@@ -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 = {
|
|
@@ -39,7 +39,7 @@ class SpoSearchCommand extends SpoCommand {
|
|
|
39
39
|
await logger.logToStderr(`Executing search query '${args.options.queryText}' on site at ${webUrl}...`);
|
|
40
40
|
}
|
|
41
41
|
const results = await this.executeSearchQuery(logger, args, webUrl, []);
|
|
42
|
-
this.printResults(logger, args, results);
|
|
42
|
+
await this.printResults(logger, args, results);
|
|
43
43
|
}
|
|
44
44
|
catch (err) {
|
|
45
45
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -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) {
|