@pnp/cli-microsoft365 7.0.0-beta.2756488 → 7.0.0-beta.4bb805e
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/dist/Command.js +1 -1
- package/dist/cli/Cli.js +23 -8
- package/dist/m365/booking/commands/business/business-get.js +14 -15
- package/dist/m365/cli/commands/config/config-set.js +1 -1
- package/dist/m365/spo/commands/list/list-roleassignment-add.js +9 -47
- package/dist/m365/spo/commands/page/page-remove.js +33 -31
- package/dist/m365/spo/commands/roledefinition/roledefinition-remove.js +25 -23
- package/dist/m365/spo/commands/site/site-apppermission-add.js +3 -3
- package/dist/m365/spo/commands/site/site-set.js +10 -2
- package/dist/utils/spo.js +74 -0
- package/docs/docs/_clisettings.mdx +1 -1
- package/docs/docs/cmd/_global.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-add.mdx +35 -0
- package/docs/docs/cmd/spo/site/site-appcatalog-add.mdx +5 -1
- package/docs/docs/cmd/spo/site/site-appcatalog-list.mdx +14 -0
- package/docs/docs/cmd/spo/site/site-appcatalog-remove.mdx +4 -0
- package/docs/docs/cmd/spo/site/site-apppermission-add.mdx +68 -0
- package/docs/docs/cmd/spo/site/site-apppermission-get.mdx +55 -0
- package/docs/docs/cmd/spo/site/site-apppermission-list.mdx +55 -0
- package/docs/docs/cmd/spo/site/site-apppermission-remove.mdx +4 -0
- package/docs/docs/cmd/spo/site/site-apppermission-set.mdx +66 -0
- package/docs/docs/cmd/spo/site/site-chrome-set.mdx +4 -0
- package/docs/docs/cmd/spo/site/site-ensure.mdx +70 -0
- package/docs/docs/cmd/spo/site/site-get.mdx +179 -0
- package/docs/docs/cmd/spo/site/site-groupify.mdx +54 -0
- package/docs/docs/cmd/spo/site/site-hubsite-connect.mdx +4 -0
- package/docs/docs/cmd/spo/site/site-hubsite-disconnect.mdx +4 -0
- package/docs/docs/cmd/spo/site/site-hubsite-theme-sync.mdx +5 -1
- package/docs/docs/cmd/spo/site/site-inplacerecordsmanagement-set.mdx +4 -0
- package/docs/docs/cmd/spo/site/site-list.mdx +303 -0
- package/docs/docs/cmd/spo/site/site-recyclebinitem-list.mdx +80 -0
- package/docs/docs/cmd/spo/site/site-recyclebinitem-restore.mdx +4 -0
- package/docs/docs/cmd/spo/site/site-remove.mdx +4 -0
- package/docs/docs/cmd/spo/site/site-rename.mdx +92 -0
- package/docs/docs/cmd/spo/site/site-set.mdx +13 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-add.mdx +116 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-apply.mdx +125 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-get.mdx +117 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-list.mdx +94 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-remove.mdx +4 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-rights-grant.mdx +4 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-rights-list.mdx +54 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-rights-revoke.mdx +4 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-run-list.mdx +66 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-run-status-get.mdx +65 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-set.mdx +117 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-task-get.mdx +61 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-task-list.mdx +60 -0
- package/docs/docs/cmd/spo/sitedesign/sitedesign-task-remove.mdx +4 -0
- package/docs/docs/cmd/spo/sitescript/sitescript-add.mdx +75 -0
- package/docs/docs/cmd/spo/sitescript/sitescript-get.mdx +62 -0
- package/docs/docs/cmd/spo/sitescript/sitescript-list.mdx +60 -0
- package/docs/docs/cmd/spo/sitescript/sitescript-remove.mdx +4 -0
- package/docs/docs/cmd/spo/sitescript/sitescript-set.mdx +63 -0
- package/docs/docs/cmd/spo/storageentity/storageentity-get.mdx +53 -0
- package/docs/docs/cmd/spo/storageentity/storageentity-list.mdx +54 -0
- package/docs/docs/cmd/spo/storageentity/storageentity-remove.mdx +4 -0
- package/docs/docs/cmd/spo/storageentity/storageentity-set.mdx +4 -0
- package/docs/docs/cmd/spo/tenant/tenant-appcatalog-add.mdx +4 -0
- package/docs/docs/cmd/spo/tenant/tenant-appcatalogurl-get.mdx +35 -0
- package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-list.mdx +67 -0
- package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-remove.mdx +4 -0
- package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-restore.mdx +50 -0
- package/docs/docs/cmd/spo/tenant/tenant-settings-list.mdx +729 -0
- package/docs/docs/cmd/spo/tenant/tenant-settings-set.mdx +5 -0
- package/docs/docs/cmd/spo/theme/theme-apply.mdx +35 -0
- package/docs/docs/cmd/spo/theme/theme-get.mdx +74 -0
- package/docs/docs/cmd/spo/theme/theme-list.mdx +52 -0
- package/docs/docs/cmd/spo/theme/theme-remove.mdx +4 -0
- package/docs/docs/cmd/spo/theme/theme-set.mdx +4 -0
- package/npm-shrinkwrap.json +212 -212
- package/package.json +10 -10
package/dist/Command.js
CHANGED
|
@@ -40,7 +40,7 @@ class CommandErrorWithOutput {
|
|
|
40
40
|
exports.CommandErrorWithOutput = CommandErrorWithOutput;
|
|
41
41
|
class Command {
|
|
42
42
|
get allowedOutputs() {
|
|
43
|
-
return ['csv', 'json', 'md', 'text'];
|
|
43
|
+
return ['csv', 'json', 'md', 'text', 'none'];
|
|
44
44
|
}
|
|
45
45
|
constructor() {
|
|
46
46
|
// These functions must be defined with # so that they're truly private
|
package/dist/cli/Cli.js
CHANGED
|
@@ -107,7 +107,9 @@ class Cli {
|
|
|
107
107
|
showHelp ||
|
|
108
108
|
parsedArgs.h ||
|
|
109
109
|
parsedArgs.help) {
|
|
110
|
-
|
|
110
|
+
if (parsedArgs.output !== 'none') {
|
|
111
|
+
this.printHelp(this.getHelpMode(parsedArgs));
|
|
112
|
+
}
|
|
111
113
|
return Promise.resolve();
|
|
112
114
|
}
|
|
113
115
|
const optionsWithoutShorts = Cli.removeShortOptions(this.optionsFromArgs);
|
|
@@ -144,11 +146,21 @@ class Cli {
|
|
|
144
146
|
return __awaiter(this, void 0, void 0, function* () {
|
|
145
147
|
const logger = {
|
|
146
148
|
log: (message) => {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
if (args.options.output !== 'none') {
|
|
150
|
+
const output = Cli.formatOutput(command, message, args.options);
|
|
151
|
+
Cli.log(output);
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
logRaw: (message) => {
|
|
155
|
+
if (args.options.output !== 'none') {
|
|
156
|
+
Cli.log(message);
|
|
157
|
+
}
|
|
149
158
|
},
|
|
150
|
-
|
|
151
|
-
|
|
159
|
+
logToStderr: (message) => {
|
|
160
|
+
if (args.options.output !== 'none') {
|
|
161
|
+
Cli.error(message);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
152
164
|
};
|
|
153
165
|
if (args.options.debug) {
|
|
154
166
|
logger.logToStderr(`Executing command ${command.name} with options ${JSON.stringify(args)}`);
|
|
@@ -158,7 +170,7 @@ class Cli {
|
|
|
158
170
|
const cli = Cli.getInstance();
|
|
159
171
|
const parentCommandName = cli.currentCommandName;
|
|
160
172
|
cli.currentCommandName = command.getCommandName(cli.currentCommandName);
|
|
161
|
-
const showSpinner = cli.getSettingWithDefaultValue(settingsNames_1.settingsNames.showSpinner, true);
|
|
173
|
+
const showSpinner = cli.getSettingWithDefaultValue(settingsNames_1.settingsNames.showSpinner, true) && args.options.output !== 'none';
|
|
162
174
|
// don't show spinner if running tests
|
|
163
175
|
/* c8 ignore next 3 */
|
|
164
176
|
if (showSpinner && typeof global.it === 'undefined') {
|
|
@@ -207,7 +219,7 @@ class Cli {
|
|
|
207
219
|
logErr.push(message);
|
|
208
220
|
}
|
|
209
221
|
};
|
|
210
|
-
if (args.options.debug) {
|
|
222
|
+
if (args.options.debug && args.options.output !== 'none') {
|
|
211
223
|
const message = `Executing command ${command.name} with options ${JSON.stringify(args)}`;
|
|
212
224
|
if (listener && listener.stderr) {
|
|
213
225
|
listener.stderr(message);
|
|
@@ -730,8 +742,11 @@ class Cli {
|
|
|
730
742
|
Cli.log();
|
|
731
743
|
}
|
|
732
744
|
closeWithError(error, args, showHelpIfEnabled = false) {
|
|
733
|
-
const chalk = require('chalk');
|
|
734
745
|
let exitCode = 1;
|
|
746
|
+
if (args.options.output === 'none') {
|
|
747
|
+
return process.exit(exitCode);
|
|
748
|
+
}
|
|
749
|
+
const chalk = require('chalk');
|
|
735
750
|
let errorMessage = error instanceof Command_1.CommandError ? error.message : error;
|
|
736
751
|
if ((!args.options.output || args.options.output === 'json') &&
|
|
737
752
|
!this.getSettingWithDefaultValue(settingsNames_1.settingsNames.printErrorsAsPlainText, true)) {
|
|
@@ -56,26 +56,25 @@ class BookingBusinessGetCommand extends GraphCommand_1.default {
|
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
getBusinessId(options) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
.get(requestOptions)
|
|
71
|
-
.then((response) => {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
if (options.id) {
|
|
61
|
+
return options.id;
|
|
62
|
+
}
|
|
63
|
+
const requestOptions = {
|
|
64
|
+
url: `${this.resource}/v1.0/solutions/bookingBusinesses`,
|
|
65
|
+
headers: {
|
|
66
|
+
accept: 'application/json;odata.metadata=none'
|
|
67
|
+
},
|
|
68
|
+
responseType: 'json'
|
|
69
|
+
};
|
|
70
|
+
const response = yield request_1.default.get(requestOptions);
|
|
72
71
|
const name = options.name;
|
|
73
72
|
const bookingBusinesses = response.value.filter(val => { var _a; return ((_a = val.displayName) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === name.toLocaleLowerCase(); });
|
|
74
73
|
if (!bookingBusinesses.length) {
|
|
75
|
-
|
|
74
|
+
throw `The specified business with name ${options.name} does not exist.`;
|
|
76
75
|
}
|
|
77
76
|
if (bookingBusinesses.length > 1) {
|
|
78
|
-
|
|
77
|
+
throw `Multiple businesses with name ${options.name} found. Please disambiguate: ${bookingBusinesses.map(x => x.id).join(', ')}`;
|
|
79
78
|
}
|
|
80
79
|
return bookingBusinesses[0].id;
|
|
81
80
|
});
|
|
@@ -73,7 +73,7 @@ _CliConfigSetCommand_instances = new WeakSet(), _CliConfigSetCommand_initTelemet
|
|
|
73
73
|
if (CliConfigSetCommand.optionNames.indexOf(args.options.key) < 0) {
|
|
74
74
|
return `${args.options.key} is not a valid setting. Allowed values: ${CliConfigSetCommand.optionNames.join(', ')}`;
|
|
75
75
|
}
|
|
76
|
-
const allowedOutputs = ['text', 'json', 'csv', 'md'];
|
|
76
|
+
const allowedOutputs = ['text', 'json', 'csv', 'md', 'none'];
|
|
77
77
|
if (args.options.key === settingsNames_1.settingsNames.output &&
|
|
78
78
|
allowedOutputs.indexOf(args.options.value) === -1) {
|
|
79
79
|
return `${args.options.value} is not a valid value for the option ${args.options.key}. Allowed values: ${allowedOutputs.join(', ')}`;
|
|
@@ -15,16 +15,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
15
15
|
};
|
|
16
16
|
var _SpoListRoleAssignmentAddCommand_instances, _SpoListRoleAssignmentAddCommand_initTelemetry, _SpoListRoleAssignmentAddCommand_initOptions, _SpoListRoleAssignmentAddCommand_initValidators, _SpoListRoleAssignmentAddCommand_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 urlUtil_1 = require("../../../../utils/urlUtil");
|
|
22
21
|
const validation_1 = require("../../../../utils/validation");
|
|
23
22
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
24
23
|
const commands_1 = require("../../commands");
|
|
25
|
-
const
|
|
26
|
-
const SpoGroupGetCommand = require("../group/group-get");
|
|
27
|
-
const SpoRoleDefinitionListCommand = require("../roledefinition/roledefinition-list");
|
|
24
|
+
const spo_1 = require("../../../../utils/spo");
|
|
28
25
|
class SpoListRoleAssignmentAddCommand extends SpoCommand_1.default {
|
|
29
26
|
get name() {
|
|
30
27
|
return commands_1.default.LIST_ROLEASSIGNMENT_ADD;
|
|
@@ -57,13 +54,15 @@ class SpoListRoleAssignmentAddCommand extends SpoCommand_1.default {
|
|
|
57
54
|
const listServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
58
55
|
requestUrl += `GetList('${formatting_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')/`;
|
|
59
56
|
}
|
|
60
|
-
args.options.roleDefinitionId = yield this.getRoleDefinitionId(args.options);
|
|
57
|
+
args.options.roleDefinitionId = yield this.getRoleDefinitionId(args.options, logger);
|
|
61
58
|
if (args.options.upn) {
|
|
62
|
-
|
|
59
|
+
const user = yield spo_1.spo.getUserByEmail(args.options.webUrl, args.options.upn, logger, this.verbose);
|
|
60
|
+
args.options.principalId = user.Id;
|
|
63
61
|
yield this.addRoleAssignment(requestUrl, logger, args.options);
|
|
64
62
|
}
|
|
65
63
|
else if (args.options.groupName) {
|
|
66
|
-
|
|
64
|
+
const group = yield spo_1.spo.getGroupByName(args.options.webUrl, args.options.groupName, logger, this.verbose);
|
|
65
|
+
args.options.principalId = group.Id;
|
|
67
66
|
yield this.addRoleAssignment(requestUrl, logger, args.options);
|
|
68
67
|
}
|
|
69
68
|
else {
|
|
@@ -89,50 +88,13 @@ class SpoListRoleAssignmentAddCommand extends SpoCommand_1.default {
|
|
|
89
88
|
return request_1.default.post(requestOptions);
|
|
90
89
|
});
|
|
91
90
|
}
|
|
92
|
-
getRoleDefinitionId(options) {
|
|
91
|
+
getRoleDefinitionId(options, logger) {
|
|
93
92
|
return __awaiter(this, void 0, void 0, function* () {
|
|
94
93
|
if (!options.roleDefinitionName) {
|
|
95
94
|
return options.roleDefinitionId;
|
|
96
95
|
}
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
output: 'json',
|
|
100
|
-
debug: this.debug,
|
|
101
|
-
verbose: this.verbose
|
|
102
|
-
};
|
|
103
|
-
const output = yield Cli_1.Cli.executeCommandWithOutput(SpoRoleDefinitionListCommand, { options: Object.assign(Object.assign({}, roleDefinitionListCommandOptions), { _: [] }) });
|
|
104
|
-
const getRoleDefinitionListOutput = JSON.parse(output.stdout);
|
|
105
|
-
const roleDefinitionId = getRoleDefinitionListOutput.find((role) => role.Name === options.roleDefinitionName).Id;
|
|
106
|
-
return roleDefinitionId;
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
getGroupPrincipalId(options) {
|
|
110
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
-
const groupGetCommandOptions = {
|
|
112
|
-
webUrl: options.webUrl,
|
|
113
|
-
name: options.groupName,
|
|
114
|
-
output: 'json',
|
|
115
|
-
debug: this.debug,
|
|
116
|
-
verbose: this.verbose
|
|
117
|
-
};
|
|
118
|
-
const output = yield Cli_1.Cli.executeCommandWithOutput(SpoGroupGetCommand, { options: Object.assign(Object.assign({}, groupGetCommandOptions), { _: [] }) });
|
|
119
|
-
const getGroupOutput = JSON.parse(output.stdout);
|
|
120
|
-
return getGroupOutput.Id;
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
getUserPrincipalId(options) {
|
|
124
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
-
const userGetCommandOptions = {
|
|
126
|
-
webUrl: options.webUrl,
|
|
127
|
-
email: options.upn,
|
|
128
|
-
id: undefined,
|
|
129
|
-
output: 'json',
|
|
130
|
-
debug: this.debug,
|
|
131
|
-
verbose: this.verbose
|
|
132
|
-
};
|
|
133
|
-
const output = yield Cli_1.Cli.executeCommandWithOutput(SpoUserGetCommand, { options: Object.assign(Object.assign({}, userGetCommandOptions), { _: [] }) });
|
|
134
|
-
const getUserOutput = JSON.parse(output.stdout);
|
|
135
|
-
return getUserOutput.Id;
|
|
96
|
+
const roleDefinition = yield spo_1.spo.getRoleDefinitionByName(options.webUrl, options.roleDefinitionName, logger, this.verbose);
|
|
97
|
+
return roleDefinition.Id;
|
|
136
98
|
});
|
|
137
99
|
}
|
|
138
100
|
}
|
|
@@ -37,37 +37,8 @@ class SpoPageRemoveCommand extends SpoCommand_1.default {
|
|
|
37
37
|
}
|
|
38
38
|
commandAction(logger, args) {
|
|
39
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
let requestDigest = '';
|
|
41
|
-
let pageName = args.options.name;
|
|
42
|
-
const removePage = () => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
try {
|
|
44
|
-
const reqDigest = yield spo_1.spo.getRequestDigest(args.options.webUrl);
|
|
45
|
-
requestDigest = reqDigest.FormDigestValue;
|
|
46
|
-
if (!pageName.endsWith('.aspx')) {
|
|
47
|
-
pageName += '.aspx';
|
|
48
|
-
}
|
|
49
|
-
if (this.verbose) {
|
|
50
|
-
logger.logToStderr(`Removing page ${pageName}...`);
|
|
51
|
-
}
|
|
52
|
-
const requestOptions = {
|
|
53
|
-
url: `${args.options
|
|
54
|
-
.webUrl}/_api/web/getfilebyserverrelativeurl('${urlUtil_1.urlUtil.getServerRelativeSiteUrl(args.options.webUrl)}/sitepages/${pageName}')`,
|
|
55
|
-
headers: {
|
|
56
|
-
'X-RequestDigest': requestDigest,
|
|
57
|
-
'X-HTTP-Method': 'DELETE',
|
|
58
|
-
'content-type': 'application/json;odata=nometadata',
|
|
59
|
-
accept: 'application/json;odata=nometadata'
|
|
60
|
-
},
|
|
61
|
-
responseType: 'json'
|
|
62
|
-
};
|
|
63
|
-
yield request_1.default.post(requestOptions);
|
|
64
|
-
}
|
|
65
|
-
catch (err) {
|
|
66
|
-
this.handleRejectedODataJsonPromise(err);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
40
|
if (args.options.force) {
|
|
70
|
-
yield removePage();
|
|
41
|
+
yield this.removePage(logger, args);
|
|
71
42
|
}
|
|
72
43
|
else {
|
|
73
44
|
const result = yield Cli_1.Cli.prompt({
|
|
@@ -77,11 +48,42 @@ class SpoPageRemoveCommand extends SpoCommand_1.default {
|
|
|
77
48
|
message: `Are you sure you want to remove the page '${args.options.name}'?`
|
|
78
49
|
});
|
|
79
50
|
if (result.continue) {
|
|
80
|
-
yield removePage();
|
|
51
|
+
yield this.removePage(logger, args);
|
|
81
52
|
}
|
|
82
53
|
}
|
|
83
54
|
});
|
|
84
55
|
}
|
|
56
|
+
removePage(logger, args) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
try {
|
|
59
|
+
let requestDigest = '';
|
|
60
|
+
let pageName = args.options.name;
|
|
61
|
+
const reqDigest = yield spo_1.spo.getRequestDigest(args.options.webUrl);
|
|
62
|
+
requestDigest = reqDigest.FormDigestValue;
|
|
63
|
+
if (!pageName.endsWith('.aspx')) {
|
|
64
|
+
pageName += '.aspx';
|
|
65
|
+
}
|
|
66
|
+
if (this.verbose) {
|
|
67
|
+
logger.logToStderr(`Removing page ${pageName}...`);
|
|
68
|
+
}
|
|
69
|
+
const requestOptions = {
|
|
70
|
+
url: `${args.options
|
|
71
|
+
.webUrl}/_api/web/getfilebyserverrelativeurl('${urlUtil_1.urlUtil.getServerRelativeSiteUrl(args.options.webUrl)}/sitepages/${pageName}')`,
|
|
72
|
+
headers: {
|
|
73
|
+
'X-RequestDigest': requestDigest,
|
|
74
|
+
'X-HTTP-Method': 'DELETE',
|
|
75
|
+
'content-type': 'application/json;odata=nometadata',
|
|
76
|
+
accept: 'application/json;odata=nometadata'
|
|
77
|
+
},
|
|
78
|
+
responseType: 'json'
|
|
79
|
+
};
|
|
80
|
+
yield request_1.default.post(requestOptions);
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
this.handleRejectedODataJsonPromise(err);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
85
87
|
}
|
|
86
88
|
_SpoPageRemoveCommand_instances = new WeakSet(), _SpoPageRemoveCommand_initOptions = function _SpoPageRemoveCommand_initOptions() {
|
|
87
89
|
this.options.unshift({
|
|
@@ -36,29 +36,8 @@ class SpoRoleDefinitionRemoveCommand extends SpoCommand_1.default {
|
|
|
36
36
|
}
|
|
37
37
|
commandAction(logger, args) {
|
|
38
38
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
const removeRoleDefinition = () => __awaiter(this, void 0, void 0, function* () {
|
|
40
|
-
if (this.verbose) {
|
|
41
|
-
logger.logToStderr(`Removing role definition from site ${args.options.webUrl}...`);
|
|
42
|
-
}
|
|
43
|
-
const requestOptions = {
|
|
44
|
-
url: `${args.options.webUrl}/_api/web/roledefinitions(${args.options.id})`,
|
|
45
|
-
method: 'delete',
|
|
46
|
-
headers: {
|
|
47
|
-
'X-HTTP-Method': 'DELETE',
|
|
48
|
-
'If-Match': '*',
|
|
49
|
-
'accept': 'application/json;odata=nometadata'
|
|
50
|
-
},
|
|
51
|
-
responseType: 'json'
|
|
52
|
-
};
|
|
53
|
-
try {
|
|
54
|
-
yield request_1.default.delete(requestOptions);
|
|
55
|
-
}
|
|
56
|
-
catch (err) {
|
|
57
|
-
this.handleRejectedODataJsonPromise(err);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
39
|
if (args.options.force) {
|
|
61
|
-
yield removeRoleDefinition();
|
|
40
|
+
yield this.removeRoleDefinition(logger, args);
|
|
62
41
|
}
|
|
63
42
|
else {
|
|
64
43
|
const result = yield Cli_1.Cli.prompt({
|
|
@@ -68,11 +47,34 @@ class SpoRoleDefinitionRemoveCommand extends SpoCommand_1.default {
|
|
|
68
47
|
message: `Are you sure you want to remove the role definition with id ${args.options.id} from site ${args.options.webUrl}?`
|
|
69
48
|
});
|
|
70
49
|
if (result.continue) {
|
|
71
|
-
yield removeRoleDefinition();
|
|
50
|
+
yield this.removeRoleDefinition(logger, args);
|
|
72
51
|
}
|
|
73
52
|
}
|
|
74
53
|
});
|
|
75
54
|
}
|
|
55
|
+
removeRoleDefinition(logger, args) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
if (this.verbose) {
|
|
58
|
+
logger.logToStderr(`Removing role definition from site ${args.options.webUrl}...`);
|
|
59
|
+
}
|
|
60
|
+
const requestOptions = {
|
|
61
|
+
url: `${args.options.webUrl}/_api/web/roledefinitions(${args.options.id})`,
|
|
62
|
+
method: 'delete',
|
|
63
|
+
headers: {
|
|
64
|
+
'X-HTTP-Method': 'DELETE',
|
|
65
|
+
'If-Match': '*',
|
|
66
|
+
'accept': 'application/json;odata=nometadata'
|
|
67
|
+
},
|
|
68
|
+
responseType: 'json'
|
|
69
|
+
};
|
|
70
|
+
try {
|
|
71
|
+
yield request_1.default.delete(requestOptions);
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
this.handleRejectedODataJsonPromise(err);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
76
78
|
}
|
|
77
79
|
_SpoRoleDefinitionRemoveCommand_instances = new WeakSet(), _SpoRoleDefinitionRemoveCommand_initTelemetry = function _SpoRoleDefinitionRemoveCommand_initTelemetry() {
|
|
78
80
|
this.telemetry.push((args) => {
|
|
@@ -47,10 +47,10 @@ class SpoSiteAppPermissionAddCommand extends GraphCommand_1.default {
|
|
|
47
47
|
}
|
|
48
48
|
let endpoint = "";
|
|
49
49
|
if (args.options.appId) {
|
|
50
|
-
endpoint = `${this.resource}/v1.0/myorganization/
|
|
50
|
+
endpoint = `${this.resource}/v1.0/myorganization/servicePrincipals?$select=appId,displayName&$filter=appId eq '${formatting_1.formatting.encodeQueryParameter(args.options.appId)}'`;
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
|
-
endpoint = `${this.resource}/v1.0/myorganization/
|
|
53
|
+
endpoint = `${this.resource}/v1.0/myorganization/servicePrincipals?$select=appId,displayName&$filter=displayName eq '${formatting_1.formatting.encodeQueryParameter(args.options.appDisplayName)}'`;
|
|
54
54
|
}
|
|
55
55
|
const appRequestOptions = {
|
|
56
56
|
url: endpoint,
|
|
@@ -168,7 +168,7 @@ _SpoSiteAppPermissionAddCommand_instances = new WeakSet(), _SpoSiteAppPermission
|
|
|
168
168
|
return validation_1.validation.isValidSharePointUrl(args.options.siteUrl);
|
|
169
169
|
}));
|
|
170
170
|
}, _SpoSiteAppPermissionAddCommand_initOptionSets = function _SpoSiteAppPermissionAddCommand_initOptionSets() {
|
|
171
|
-
this.optionSets.push({ options: ['appId', 'appDisplayName'] });
|
|
171
|
+
this.optionSets.push({ options: ['appId', 'appDisplayName'], runsWhen: (args) => !args.options.appId && !args.options.appDisplayName });
|
|
172
172
|
};
|
|
173
173
|
module.exports = new SpoSiteAppPermissionAddCommand();
|
|
174
174
|
//# sourceMappingURL=site-apppermission-add.js.map
|
|
@@ -311,7 +311,7 @@ class SpoSiteSetCommand extends SpoCommand_1.default {
|
|
|
311
311
|
}
|
|
312
312
|
updateSiteProperties(logger, args) {
|
|
313
313
|
const isGroupConnectedSite = this.isGroupConnectedSite();
|
|
314
|
-
const sharedProperties = ['classification', 'disableFlows', 'shareByEmailEnabled', 'sharingCapability', 'noScriptSite'];
|
|
314
|
+
const sharedProperties = ['classification', 'disableFlows', 'socialBarOnSitePagesDisabled', 'shareByEmailEnabled', 'sharingCapability', 'noScriptSite'];
|
|
315
315
|
const siteProperties = ['title', 'resourceQuota', 'resourceQuotaWarningLevel', 'storageQuota', 'storageQuotaWarningLevel', 'allowSelfServiceUpgrade'];
|
|
316
316
|
let properties = sharedProperties;
|
|
317
317
|
properties = properties;
|
|
@@ -363,6 +363,9 @@ class SpoSiteSetCommand extends SpoCommand_1.default {
|
|
|
363
363
|
if (typeof args.options.disableFlows !== 'undefined') {
|
|
364
364
|
payload.push(`<SetProperty Id="${propertyId++}" ObjectPathId="5" Name="DisableFlows"><Parameter Type="Boolean">${args.options.disableFlows}</Parameter></SetProperty>`);
|
|
365
365
|
}
|
|
366
|
+
if (typeof args.options.socialBarOnSitePagesDisabled !== 'undefined') {
|
|
367
|
+
payload.push(`<SetProperty Id="${propertyId++}" ObjectPathId="5" Name="SocialBarOnSitePagesDisabled"><Parameter Type="Boolean">${args.options.socialBarOnSitePagesDisabled}</Parameter></SetProperty>`);
|
|
368
|
+
}
|
|
366
369
|
if (typeof args.options.shareByEmailEnabled !== 'undefined') {
|
|
367
370
|
payload.push(`<SetProperty Id="${propertyId++}" ObjectPathId="5" Name="ShareByEmailEnabled"><Parameter Type="Boolean">${args.options.shareByEmailEnabled}</Parameter></SetProperty>`);
|
|
368
371
|
}
|
|
@@ -442,6 +445,7 @@ _SpoSiteSetCommand_instances = new WeakSet(), _SpoSiteSetCommand_initTelemetry =
|
|
|
442
445
|
Object.assign(this.telemetryProperties, {
|
|
443
446
|
classification: typeof args.options.classification === 'string',
|
|
444
447
|
disableFlows: args.options.disableFlows,
|
|
448
|
+
socialBarOnSitePagesDisabled: args.options.socialBarOnSitePagesDisabled,
|
|
445
449
|
isPublic: args.options.isPublic,
|
|
446
450
|
owners: typeof args.options.owners !== 'undefined',
|
|
447
451
|
shareByEmailEnabled: args.options.shareByEmailEnabled,
|
|
@@ -470,6 +474,9 @@ _SpoSiteSetCommand_instances = new WeakSet(), _SpoSiteSetCommand_initTelemetry =
|
|
|
470
474
|
}, {
|
|
471
475
|
option: '--disableFlows [disableFlows]',
|
|
472
476
|
autocomplete: ['true', 'false']
|
|
477
|
+
}, {
|
|
478
|
+
option: '--socialBarOnSitePagesDisabled [socialBarOnSitePagesDisabled]',
|
|
479
|
+
autocomplete: ['true', 'false']
|
|
473
480
|
}, {
|
|
474
481
|
option: '--isPublic [isPublic]',
|
|
475
482
|
autocomplete: ['true', 'false']
|
|
@@ -517,6 +524,7 @@ _SpoSiteSetCommand_instances = new WeakSet(), _SpoSiteSetCommand_initTelemetry =
|
|
|
517
524
|
}
|
|
518
525
|
if (typeof args.options.classification === 'undefined' &&
|
|
519
526
|
typeof args.options.disableFlows === 'undefined' &&
|
|
527
|
+
typeof args.options.socialBarOnSitePagesDisabled === 'undefined' &&
|
|
520
528
|
typeof args.options.title === 'undefined' &&
|
|
521
529
|
typeof args.options.description === 'undefined' &&
|
|
522
530
|
typeof args.options.isPublic === 'undefined' &&
|
|
@@ -580,7 +588,7 @@ _SpoSiteSetCommand_instances = new WeakSet(), _SpoSiteSetCommand_initTelemetry =
|
|
|
580
588
|
}));
|
|
581
589
|
}, _SpoSiteSetCommand_initTypes = function _SpoSiteSetCommand_initTypes() {
|
|
582
590
|
this.types.string.push('classification');
|
|
583
|
-
this.types.boolean.push('isPublic', 'disableFlows', 'shareByEmailEnabled', 'allowSelfServiceUpgrade', 'noScriptSite');
|
|
591
|
+
this.types.boolean.push('isPublic', 'disableFlows', 'socialBarOnSitePagesDisabled', 'shareByEmailEnabled', 'allowSelfServiceUpgrade', 'noScriptSite');
|
|
584
592
|
};
|
|
585
593
|
module.exports = new SpoSiteSetCommand();
|
|
586
594
|
//# sourceMappingURL=site-set.js.map
|
package/dist/utils/spo.js
CHANGED
|
@@ -19,6 +19,7 @@ const base_permissions_1 = require("../m365/spo/base-permissions");
|
|
|
19
19
|
const request_1 = require("../request");
|
|
20
20
|
const formatting_1 = require("./formatting");
|
|
21
21
|
const odata_1 = require("./odata");
|
|
22
|
+
const RoleType_1 = require("../m365/spo/commands/roledefinition/RoleType");
|
|
22
23
|
exports.spo = {
|
|
23
24
|
getRequestDigest(siteUrl) {
|
|
24
25
|
const requestOptions = {
|
|
@@ -569,6 +570,30 @@ exports.spo = {
|
|
|
569
570
|
return res.AadObjectId.NameId;
|
|
570
571
|
});
|
|
571
572
|
},
|
|
573
|
+
/**
|
|
574
|
+
* Retrieves the spo user by email.
|
|
575
|
+
* @param webUrl Web url
|
|
576
|
+
* @param email The email of the user
|
|
577
|
+
* @param logger the Logger object
|
|
578
|
+
* @param debug set if debug logging should be logged
|
|
579
|
+
*/
|
|
580
|
+
getUserByEmail(webUrl, email, logger, debug) {
|
|
581
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
582
|
+
if (debug) {
|
|
583
|
+
logger.logToStderr(`Retrieving the spo user by email ${email}`);
|
|
584
|
+
}
|
|
585
|
+
const requestUrl = `${webUrl}/_api/web/siteusers/GetByEmail('${formatting_1.formatting.encodeQueryParameter(email)}')`;
|
|
586
|
+
const requestOptions = {
|
|
587
|
+
url: requestUrl,
|
|
588
|
+
headers: {
|
|
589
|
+
'accept': 'application/json;odata=nometadata'
|
|
590
|
+
},
|
|
591
|
+
responseType: 'json'
|
|
592
|
+
};
|
|
593
|
+
const userInstance = yield request_1.default.get(requestOptions);
|
|
594
|
+
return userInstance;
|
|
595
|
+
});
|
|
596
|
+
},
|
|
572
597
|
/**
|
|
573
598
|
* Retrieves the menu state for the quick launch.
|
|
574
599
|
* @param webUrl Web url
|
|
@@ -628,6 +653,55 @@ exports.spo = {
|
|
|
628
653
|
};
|
|
629
654
|
return request_1.default.post(requestOptions);
|
|
630
655
|
});
|
|
656
|
+
},
|
|
657
|
+
/**
|
|
658
|
+
* Retrieves the spo group by name.
|
|
659
|
+
* @param webUrl Web url
|
|
660
|
+
* @param name The name of the group
|
|
661
|
+
* @param logger the Logger object
|
|
662
|
+
* @param debug set if debug logging should be logged
|
|
663
|
+
*/
|
|
664
|
+
getGroupByName(webUrl, name, logger, debug) {
|
|
665
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
666
|
+
if (debug) {
|
|
667
|
+
logger.logToStderr(`Retrieving the group by name ${name}`);
|
|
668
|
+
}
|
|
669
|
+
const requestUrl = `${webUrl}/_api/web/sitegroups/GetByName('${formatting_1.formatting.encodeQueryParameter(name)}')`;
|
|
670
|
+
const requestOptions = {
|
|
671
|
+
url: requestUrl,
|
|
672
|
+
headers: {
|
|
673
|
+
'accept': 'application/json;odata=nometadata'
|
|
674
|
+
},
|
|
675
|
+
responseType: 'json'
|
|
676
|
+
};
|
|
677
|
+
const groupInstance = yield request_1.default.get(requestOptions);
|
|
678
|
+
return groupInstance;
|
|
679
|
+
});
|
|
680
|
+
},
|
|
681
|
+
/**
|
|
682
|
+
* Retrieves the role definition by name.
|
|
683
|
+
* @param webUrl Web url
|
|
684
|
+
* @param name the name of the role definition
|
|
685
|
+
* @param logger the Logger object
|
|
686
|
+
* @param debug set if debug logging should be logged
|
|
687
|
+
*/
|
|
688
|
+
getRoleDefinitionByName(webUrl, name, logger, debug) {
|
|
689
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
690
|
+
if (debug) {
|
|
691
|
+
logger.logToStderr(`Retrieving the role definitions for ${name}`);
|
|
692
|
+
}
|
|
693
|
+
const roledefinitions = yield odata_1.odata.getAllItems(`${webUrl}/_api/web/roledefinitions`);
|
|
694
|
+
const roledefinition = roledefinitions.find((role) => role.Name === name);
|
|
695
|
+
if (!roledefinition) {
|
|
696
|
+
throw `No roledefinition is found for ${name}`;
|
|
697
|
+
}
|
|
698
|
+
const permissions = new base_permissions_1.BasePermissions();
|
|
699
|
+
permissions.high = roledefinition.BasePermissions.High;
|
|
700
|
+
permissions.low = roledefinition.BasePermissions.Low;
|
|
701
|
+
roledefinition.BasePermissionsValue = permissions.parse();
|
|
702
|
+
roledefinition.RoleTypeKindValue = RoleType_1.RoleType[roledefinition.RoleTypeKind];
|
|
703
|
+
return roledefinition;
|
|
704
|
+
});
|
|
631
705
|
}
|
|
632
706
|
};
|
|
633
707
|
//# sourceMappingURL=spo.js.map
|
|
@@ -10,7 +10,7 @@ Setting name|Definition|Default value
|
|
|
10
10
|
`disableTelemetry`|Disables sending of telemetry data|`false`
|
|
11
11
|
`errorOutput`|Defines if errors should be written to `stdout` or `stderr`|`stderr`
|
|
12
12
|
`helpMode`|Defines what part of command's help to display. Allowed values are `options`, `examples`, `remarks`, `response`, `full`|`full`
|
|
13
|
-
`output`|Defines the default output when issuing a command
|
|
13
|
+
`output`|Defines the default output when issuing a command. Allowed values are `json`, `text`, `csv`, `md`, `none`|`json`
|
|
14
14
|
`printErrorsAsPlainText`|When output mode is set to `json`, print error messages as plain-text rather than JSON|`true`
|
|
15
15
|
`prompt`|Prompts for missing values in required options and enables interactive selection when multiple values are available for a command that requires a specific value to be retrieved.|`false`
|
|
16
16
|
`showHelpOnFailure`|Automatically display help when executing a command failed|`true`
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
: JMESPath query string. See [http://jmespath.org/](http://jmespath.org/) for more information and examples.
|
|
7
7
|
|
|
8
8
|
`-o, --output [output]`
|
|
9
|
-
: Output type. `json`, `text`, `csv`, `md`. Default `json`.
|
|
9
|
+
: Output type. `json`, `text`, `csv`, `md`, `none`. Default `json`.
|
|
10
10
|
|
|
11
11
|
`--verbose`
|
|
12
12
|
: Runs command with verbose logging.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import Global from '/docs/cmd/_global.mdx';
|
|
2
|
+
import Tabs from '@theme/Tabs';
|
|
3
|
+
import TabItem from '@theme/TabItem';
|
|
2
4
|
|
|
3
5
|
# spo site add
|
|
4
6
|
|
|
@@ -178,6 +180,39 @@ Create new classic site collection using the Team site template. Set time zone t
|
|
|
178
180
|
m365 spo site add --type ClassicSite --url https://contoso.sharepoint.com/sites/team --title Team --owners admin@contoso.onmicrosoft.com --timeZone 4 --webTemplate STS#0 --removeDeletedSite --wait
|
|
179
181
|
```
|
|
180
182
|
|
|
183
|
+
## Response
|
|
184
|
+
|
|
185
|
+
<Tabs>
|
|
186
|
+
<TabItem value="JSON">
|
|
187
|
+
|
|
188
|
+
```json
|
|
189
|
+
"https://contoso.sharepoint.com/sites/marketing"
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
</TabItem>
|
|
193
|
+
<TabItem value="Text">
|
|
194
|
+
|
|
195
|
+
```text
|
|
196
|
+
https://contoso.sharepoint.com/sites/marketing
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
</TabItem>
|
|
200
|
+
<TabItem value="CSV">
|
|
201
|
+
|
|
202
|
+
```csv
|
|
203
|
+
https://contoso.sharepoint.com/sites/marketing
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
</TabItem>
|
|
207
|
+
<TabItem value="Markdown">
|
|
208
|
+
|
|
209
|
+
```md
|
|
210
|
+
https://contoso.sharepoint.com/sites/marketing
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
</TabItem>
|
|
214
|
+
</Tabs>
|
|
215
|
+
|
|
181
216
|
## More information
|
|
182
217
|
|
|
183
218
|
- Creating SharePoint Communication Site using REST: [https://docs.microsoft.com/en-us/sharepoint/dev/apis/communication-site-creation-rest](https://docs.microsoft.com/en-us/sharepoint/dev/apis/communication-site-creation-rest)
|
|
@@ -32,9 +32,13 @@ To use this command you have to have permissions to access the tenant admin site
|
|
|
32
32
|
Add a site collection app catalog to the specified site
|
|
33
33
|
|
|
34
34
|
```sh
|
|
35
|
-
m365 spo site appcatalog add --siteUrl https://contoso.sharepoint/sites/site
|
|
35
|
+
m365 spo site appcatalog add --siteUrl https://contoso.sharepoint.com/sites/site
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
## Response
|
|
39
|
+
|
|
40
|
+
The command won't return a response on success.
|
|
41
|
+
|
|
38
42
|
## More information
|
|
39
43
|
|
|
40
44
|
- Use the site collection app catalog: [https://docs.microsoft.com/en-us/sharepoint/dev/general-development/site-collection-app-catalog](https://docs.microsoft.com/en-us/sharepoint/dev/general-development/site-collection-app-catalog)
|
|
@@ -64,6 +64,20 @@ m365 spo site appcatalog list
|
|
|
64
64
|
https://contoso.sharepoint.com/sites/site1,9798e615-b586-455e-8486-84913f492c49
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
+
</TabItem>
|
|
68
|
+
<TabItem value="Markdown">
|
|
69
|
+
|
|
70
|
+
```md
|
|
71
|
+
# spo site appcatalog list
|
|
72
|
+
|
|
73
|
+
Date: 2023-06-21
|
|
74
|
+
|
|
75
|
+
Property | Value
|
|
76
|
+
---------|-------
|
|
77
|
+
AbsoluteUrl | https://contoso.sharepoint.com/sites/site1
|
|
78
|
+
SiteID | 9798e615-b586-455e-8486-84913f492c49
|
|
79
|
+
```
|
|
80
|
+
|
|
67
81
|
</TabItem>
|
|
68
82
|
</Tabs>
|
|
69
83
|
|