@pnp/cli-microsoft365 6.11.0-beta.ee225fb → 6.11.0
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/Auth.js +2 -1
- package/dist/Command.js +1 -1
- package/dist/m365/pa/commands/app/app-permission-ensure.js +177 -0
- package/dist/m365/pa/commands/app/app-permission-remove.js +170 -0
- package/dist/m365/pa/commands.js +2 -0
- package/dist/m365/planner/commands/task/task-add.js +17 -11
- package/dist/m365/planner/commands/task/task-get.js +35 -25
- package/dist/m365/planner/commands/task/task-list.js +26 -19
- package/dist/m365/planner/commands/task/task-remove.js +40 -35
- package/dist/m365/planner/commands/task/task-set.js +35 -23
- package/dist/m365/spfx/commands/project/DeployWorkflow.js +58 -0
- package/dist/m365/spfx/commands/project/project-doctor/{doctor-1.18.0-beta.1.js → doctor-1.18.0-beta.5.js} +1 -1
- package/dist/m365/spfx/commands/project/project-doctor.js +1 -1
- package/dist/m365/spfx/commands/project/project-externalize/rules/PnPJsRule.js +34 -23
- package/dist/m365/spfx/commands/project/project-github-workflow-add.js +171 -0
- package/dist/m365/spfx/commands/project/project-github-workflow-model.js +3 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.15.2.js +1 -1
- package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.18.0-beta.1.js → upgrade-1.18.0-beta.5.js} +26 -26
- package/dist/m365/spfx/commands/project/project-upgrade.js +1 -1
- package/dist/m365/spfx/commands/spfx-doctor.js +35 -51
- package/dist/m365/spfx/commands.js +1 -0
- package/dist/m365/spo/commands/app/SpoAppBaseCommand.js +26 -14
- package/dist/m365/spo/commands/app/app-add.js +9 -9
- package/dist/m365/spo/commands/file/file-add.js +13 -13
- package/dist/m365/spo/commands/file/file-checkin.js +1 -1
- package/dist/m365/spo/commands/file/file-checkout.js +1 -1
- package/dist/m365/spo/commands/file/file-copy.js +38 -4
- package/dist/m365/spo/commands/file/file-list.js +4 -4
- package/dist/m365/spo/commands/file/file-move.js +2 -2
- package/dist/m365/spo/commands/file/file-remove.js +6 -6
- package/dist/m365/spo/commands/file/file-rename.js +2 -2
- package/dist/m365/spo/commands/file/file-retentionlabel-ensure.js +1 -1
- package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +1 -1
- package/dist/m365/spo/commands/file/file-roleassignment-add.js +1 -1
- package/dist/m365/spo/commands/file/file-roleassignment-remove.js +1 -1
- package/dist/m365/spo/commands/file/file-roleinheritance-break.js +1 -1
- package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +1 -1
- package/dist/m365/spo/commands/file/file-version-clear.js +1 -1
- package/dist/m365/spo/commands/file/file-version-get.js +1 -1
- package/dist/m365/spo/commands/file/file-version-list.js +1 -1
- package/dist/m365/spo/commands/file/file-version-remove.js +1 -1
- package/dist/m365/spo/commands/file/file-version-restore.js +1 -1
- package/dist/m365/spo/commands/folder/folder-add.js +2 -4
- package/dist/m365/spo/commands/folder/folder-get.js +1 -1
- package/dist/m365/spo/commands/folder/folder-list.js +2 -2
- package/dist/m365/spo/commands/folder/folder-remove.js +7 -4
- package/dist/m365/spo/commands/folder/folder-rename.js +13 -17
- package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +1 -1
- package/dist/m365/spo/commands/folder/folder-retentionlabel-remove.js +1 -1
- package/dist/m365/spo/commands/folder/folder-roleassignment-add.js +1 -1
- package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +1 -1
- package/dist/m365/spo/commands/folder/folder-roleinheritance-break.js +1 -1
- package/dist/m365/spo/commands/folder/folder-roleinheritance-reset.js +1 -1
- package/dist/m365/spo/commands/group/group-list.js +0 -1
- package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-add.js +32 -3
- package/dist/m365/spo/commands/page/Page.js +24 -32
- package/dist/m365/spo/commands/propertybag/propertybag-base.js +75 -54
- package/dist/m365/spo/commands/propertybag/propertybag-remove.js +41 -40
- package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-set.js +32 -32
- package/dist/m365/spo/commands/site/FlowsPolicy.js +10 -0
- package/dist/m365/spo/commands/site/site-add.js +113 -154
- package/dist/m365/spo/commands/site/site-apppermission-add.js +26 -27
- package/dist/m365/spo/commands/site/site-apppermission-remove.js +37 -37
- package/dist/m365/spo/commands/site/site-apppermission-set.js +15 -16
- package/dist/m365/spo/commands/site/site-ensure.js +19 -70
- package/dist/m365/spo/commands/site/site-hubsite-disconnect.js +24 -22
- package/dist/m365/spo/commands/site/site-list.js +28 -36
- package/dist/m365/spo/commands/site/site-remove.js +139 -171
- package/dist/m365/spo/commands/site/site-set.js +179 -178
- package/dist/m365/spo/commands/theme/theme-remove.js +26 -24
- package/dist/m365/spo/commands/theme/theme-set.js +0 -1
- package/dist/m365/spo/commands/user/user-remove.js +29 -27
- package/dist/m365/spo/commands/web/web-reindex.js +17 -20
- package/dist/m365/spo/commands/web/web-remove.js +23 -21
- package/dist/m365/spo/commands/web/web-roleassignment-add.js +45 -52
- package/dist/m365/spo/commands/web/web-roleassignment-remove.js +58 -61
- package/dist/m365/spo/commands/web/web-roleinheritance-break.js +20 -18
- package/dist/m365/spo/commands/web/web-roleinheritance-reset.js +21 -19
- package/dist/m365/yammer/commands/message/message-like-set.js +29 -28
- package/dist/m365/yammer/commands/message/message-list.js +9 -26
- package/dist/m365/yammer/commands/message/message-remove.js +20 -18
- package/dist/m365/yammer/commands/yammer-search.js +42 -56
- package/dist/utils/aadGroup.js +20 -0
- package/dist/utils/fsUtil.js +5 -0
- package/dist/utils/spo.js +601 -1
- package/docs/docs/cmd/pa/app/app-permission-ensure.mdx +85 -0
- package/docs/docs/cmd/pa/app/app-permission-remove.mdx +74 -0
- package/docs/docs/cmd/planner/task/task-add.mdx +22 -7
- package/docs/docs/cmd/planner/task/task-get.mdx +13 -4
- package/docs/docs/cmd/planner/task/task-list.mdx +22 -7
- package/docs/docs/cmd/planner/task/task-remove.mdx +25 -8
- package/docs/docs/cmd/planner/task/task-set.mdx +22 -7
- package/docs/docs/cmd/spfx/project/project-github-workflow-add.mdx +94 -0
- package/docs/docs/cmd/spo/file/file-add.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-checkin.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-checkout-undo.mdx +1 -9
- package/docs/docs/cmd/spo/file/file-checkout.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-copy.mdx +20 -16
- package/docs/docs/cmd/spo/file/file-get.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-list.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-move.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-remove.mdx +8 -8
- package/docs/docs/cmd/spo/file/file-rename.mdx +3 -3
- package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-retentionlabel-remove.mdx +3 -3
- package/docs/docs/cmd/spo/file/file-roleassignment-add.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-roleassignment-remove.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-roleinheritance-break.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-roleinheritance-reset.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinginfo-get.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-add.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-clear.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-get.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-list.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-remove.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-set.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-clear.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-get.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-list.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-remove.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-restore.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-add.mdx +76 -1
- package/docs/docs/cmd/spo/folder/folder-get.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-list.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-remove.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-rename.mdx +5 -1
- package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-retentionlabel-remove.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-roleassignment-add.mdx +2 -2
- package/docs/docs/cmd/spo/folder/folder-roleassignment-remove.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-roleinheritance-break.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-roleinheritance-reset.mdx +1 -1
- package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-add.mdx +14 -1
- package/docs/docs/cmd/spo/site/site-ensure.mdx +1 -1
- package/npm-shrinkwrap.json +698 -345
- package/package.json +16 -15
|
@@ -28,6 +28,7 @@ const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
|
28
28
|
const commands_1 = require("../../commands");
|
|
29
29
|
const SharingCapabilities_1 = require("../site/SharingCapabilities");
|
|
30
30
|
const spoSiteDesignApplyCommand = require("../sitedesign/sitedesign-apply");
|
|
31
|
+
const FlowsPolicy_1 = require("./FlowsPolicy");
|
|
31
32
|
class SpoSiteSetCommand extends SpoCommand_1.default {
|
|
32
33
|
get name() {
|
|
33
34
|
return commands_1.default.SITE_SET;
|
|
@@ -92,33 +93,33 @@ class SpoSiteSetCommand extends SpoCommand_1.default {
|
|
|
92
93
|
return request_1.default.post(requestOptions);
|
|
93
94
|
}
|
|
94
95
|
updateSharePointOnlySite(logger, args) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
if (this.debug) {
|
|
98
|
+
logger.logToStderr('Site is not group connected');
|
|
99
|
+
}
|
|
100
|
+
if (typeof args.options.isPublic !== 'undefined') {
|
|
101
|
+
throw `The isPublic option can't be set on a site that is not groupified`;
|
|
102
|
+
}
|
|
103
|
+
yield this.updateSiteDescription(logger, args);
|
|
104
|
+
yield this.updateSiteOwners(logger, args);
|
|
105
|
+
});
|
|
103
106
|
}
|
|
104
|
-
waitForSiteUpdateCompletion(logger, args,
|
|
105
|
-
return
|
|
106
|
-
if (!
|
|
107
|
-
resolve();
|
|
107
|
+
waitForSiteUpdateCompletion(logger, args, response) {
|
|
108
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
if (!response) {
|
|
108
110
|
return;
|
|
109
111
|
}
|
|
110
|
-
const json = JSON.parse(
|
|
111
|
-
const
|
|
112
|
-
if (
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
112
|
+
const json = JSON.parse(response);
|
|
113
|
+
const responseContent = json[0];
|
|
114
|
+
if (responseContent.ErrorInfo) {
|
|
115
|
+
throw responseContent.ErrorInfo.ErrorMessage;
|
|
116
|
+
}
|
|
117
|
+
const operation = json[json.length - 1];
|
|
118
|
+
const isComplete = operation.IsComplete;
|
|
119
|
+
if (!args.options.wait || isComplete) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
yield new Promise((resolve, reject) => {
|
|
122
123
|
setTimeout(() => {
|
|
123
124
|
spo_1.spo.waitUntilFinished({
|
|
124
125
|
operationId: JSON.stringify(operation._ObjectIdentity_),
|
|
@@ -131,29 +132,24 @@ class SpoSiteSetCommand extends SpoCommand_1.default {
|
|
|
131
132
|
verbose: this.verbose
|
|
132
133
|
});
|
|
133
134
|
}, operation.PollingInterval);
|
|
134
|
-
}
|
|
135
|
+
});
|
|
135
136
|
});
|
|
136
137
|
}
|
|
137
138
|
updateSiteOwners(logger, args) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
139
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
140
|
+
if (!args.options.owners) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
142
143
|
if (this.verbose) {
|
|
143
144
|
logger.logToStderr(`Updating site owners ${args.options.url}...`);
|
|
144
145
|
}
|
|
145
|
-
Promise.all(args.options.owners.split(',').map(o => {
|
|
146
|
+
yield Promise.all(args.options.owners.split(',').map(o => {
|
|
146
147
|
return this.setAdmin(args.options.url, o.trim());
|
|
147
|
-
}))
|
|
148
|
-
.then(() => {
|
|
149
|
-
resolve();
|
|
150
|
-
}, (err) => {
|
|
151
|
-
reject(err);
|
|
152
|
-
});
|
|
148
|
+
}));
|
|
153
149
|
});
|
|
154
150
|
}
|
|
155
151
|
setAdmin(siteUrl, principal) {
|
|
156
|
-
return
|
|
152
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
157
153
|
const requestOptions = {
|
|
158
154
|
url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
159
155
|
headers: {
|
|
@@ -161,70 +157,67 @@ class SpoSiteSetCommand extends SpoCommand_1.default {
|
|
|
161
157
|
},
|
|
162
158
|
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="48" ObjectPathId="47" /></Actions><ObjectPaths><Method Id="47" ParentId="34" Name="SetSiteAdmin"><Parameters><Parameter Type="String">${formatting_1.formatting.escapeXml(siteUrl)}</Parameter><Parameter Type="String">${formatting_1.formatting.escapeXml(principal)}</Parameter><Parameter Type="Boolean">true</Parameter></Parameters></Method><Constructor Id="34" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
|
|
163
159
|
};
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
resolve();
|
|
173
|
-
}
|
|
174
|
-
}, (err) => {
|
|
175
|
-
reject(err);
|
|
176
|
-
});
|
|
160
|
+
const response = yield request_1.default.post(requestOptions);
|
|
161
|
+
const json = JSON.parse(response);
|
|
162
|
+
const responseContent = json[0];
|
|
163
|
+
if (responseContent.ErrorInfo) {
|
|
164
|
+
throw responseContent.ErrorInfo.ErrorMessage;
|
|
165
|
+
}
|
|
177
166
|
});
|
|
178
167
|
}
|
|
179
168
|
updateSiteDescription(logger, args) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
169
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
170
|
+
if (!args.options.description) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (this.verbose) {
|
|
174
|
+
logger.logToStderr(`Setting site description ${args.options.url}...`);
|
|
175
|
+
}
|
|
176
|
+
const requestOptions = {
|
|
177
|
+
url: `${args.options.url}/_api/web`,
|
|
178
|
+
headers: {
|
|
179
|
+
'IF-MATCH': '*',
|
|
180
|
+
'Accept': 'application/json;odata=nometadata',
|
|
181
|
+
'content-type': 'application/json;odata=nometadata',
|
|
182
|
+
'X-RequestDigest': this.context.FormDigestValue,
|
|
183
|
+
'X-HTTP-Method': 'MERGE'
|
|
184
|
+
},
|
|
185
|
+
data: {
|
|
186
|
+
Description: args.options.description
|
|
187
|
+
},
|
|
188
|
+
json: true
|
|
189
|
+
};
|
|
190
|
+
yield request_1.default.post(requestOptions);
|
|
191
|
+
});
|
|
201
192
|
}
|
|
202
193
|
updateSiteLockState(logger, args) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
194
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
195
|
+
if (!args.options.lockState) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (this.verbose) {
|
|
199
|
+
logger.logToStderr(`Setting site lock state ${args.options.url}...`);
|
|
200
|
+
}
|
|
201
|
+
const requestOptions = {
|
|
202
|
+
url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
203
|
+
headers: {
|
|
204
|
+
'X-RequestDigest': this.context.FormDigestValue
|
|
205
|
+
},
|
|
206
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><SetProperty Id="7" ObjectPathId="5" Name="LockState"><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.lockState)}</Parameter></SetProperty><ObjectPath Id="9" ObjectPathId="8" /><ObjectIdentityQuery Id="10" ObjectPathId="5" /><Query Id="11" ObjectPathId="8"><Query SelectAllProperties="true"><Properties /></Query></Query></Actions><ObjectPaths><Method Id="5" ParentId="3" Name="GetSitePropertiesByUrl"><Parameters><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.url)}</Parameter><Parameter Type="Boolean">false</Parameter></Parameters></Method><Method Id="8" ParentId="5" Name="Update" /><Constructor Id="3" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
|
|
207
|
+
};
|
|
208
|
+
return request_1.default.post(requestOptions);
|
|
209
|
+
});
|
|
217
210
|
}
|
|
218
211
|
updateGroupConnectedSite(logger, args) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
212
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
213
|
+
if (this.debug) {
|
|
214
|
+
logger.logToStderr(`Site attached to group ${this.groupId}`);
|
|
215
|
+
}
|
|
223
216
|
if (typeof args.options.title === 'undefined' &&
|
|
224
217
|
typeof args.options.description === 'undefined' &&
|
|
225
218
|
typeof args.options.isPublic === 'undefined' &&
|
|
226
219
|
typeof args.options.owners === 'undefined') {
|
|
227
|
-
return
|
|
220
|
+
return;
|
|
228
221
|
}
|
|
229
222
|
const promises = [];
|
|
230
223
|
if (typeof args.options.title !== 'undefined') {
|
|
@@ -257,13 +250,7 @@ class SpoSiteSetCommand extends SpoCommand_1.default {
|
|
|
257
250
|
promises.push(this.setGroupifiedSiteDescription(args.options.description));
|
|
258
251
|
}
|
|
259
252
|
promises.push(this.setGroupifiedSiteOwners(logger, args));
|
|
260
|
-
Promise
|
|
261
|
-
.all(promises)
|
|
262
|
-
.then(() => {
|
|
263
|
-
resolve();
|
|
264
|
-
}, (error) => {
|
|
265
|
-
reject(error);
|
|
266
|
-
});
|
|
253
|
+
yield Promise.all(promises);
|
|
267
254
|
});
|
|
268
255
|
}
|
|
269
256
|
setGroupifiedSiteDescription(description) {
|
|
@@ -279,26 +266,26 @@ class SpoSiteSetCommand extends SpoCommand_1.default {
|
|
|
279
266
|
return request_1.default.patch(requestOptions);
|
|
280
267
|
}
|
|
281
268
|
setGroupifiedSiteOwners(logger, args) {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
const owners = args.options.owners.split(',').map(o => o.trim());
|
|
286
|
-
if (this.verbose) {
|
|
287
|
-
logger.logToStderr('Retrieving user information to set group owners...');
|
|
288
|
-
}
|
|
289
|
-
const requestOptions = {
|
|
290
|
-
url: `https://graph.microsoft.com/v1.0/users?$filter=${owners.map(o => `userPrincipalName eq '${o}'`).join(' or ')}&$select=id`,
|
|
291
|
-
headers: {
|
|
292
|
-
'content-type': 'application/json;odata.metadata=none'
|
|
293
|
-
},
|
|
294
|
-
responseType: 'json'
|
|
295
|
-
};
|
|
296
|
-
return request_1.default.get(requestOptions)
|
|
297
|
-
.then((res) => {
|
|
298
|
-
if (res.value.length === 0) {
|
|
299
|
-
return Promise.resolve();
|
|
269
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
270
|
+
if (typeof args.options.owners === 'undefined') {
|
|
271
|
+
return;
|
|
300
272
|
}
|
|
301
|
-
|
|
273
|
+
const owners = args.options.owners.split(',').map(o => o.trim());
|
|
274
|
+
if (this.verbose) {
|
|
275
|
+
logger.logToStderr('Retrieving user information to set group owners...');
|
|
276
|
+
}
|
|
277
|
+
const requestOptions = {
|
|
278
|
+
url: `https://graph.microsoft.com/v1.0/users?$filter=${owners.map(o => `userPrincipalName eq '${o}'`).join(' or ')}&$select=id`,
|
|
279
|
+
headers: {
|
|
280
|
+
'content-type': 'application/json;odata.metadata=none'
|
|
281
|
+
},
|
|
282
|
+
responseType: 'json'
|
|
283
|
+
};
|
|
284
|
+
const response = yield request_1.default.get(requestOptions);
|
|
285
|
+
if (response.value.length === 0) {
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
yield Promise.all(response.value.map(user => {
|
|
302
289
|
const requestOptions = {
|
|
303
290
|
url: `${this.spoAdminUrl}/_api/SP.Directory.DirectorySession/Group('${this.groupId}')/Owners/Add(objectId='${user.id}', principalName='')`,
|
|
304
291
|
headers: {
|
|
@@ -310,33 +297,31 @@ class SpoSiteSetCommand extends SpoCommand_1.default {
|
|
|
310
297
|
});
|
|
311
298
|
}
|
|
312
299
|
updateSiteProperties(logger, args) {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
let updatedProperties = false;
|
|
322
|
-
for (let i = 0; i < properties.length; i++) {
|
|
323
|
-
if (typeof args.options[properties[i]] !== 'undefined') {
|
|
324
|
-
updatedProperties = true;
|
|
325
|
-
break;
|
|
300
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
301
|
+
const isGroupConnectedSite = this.isGroupConnectedSite();
|
|
302
|
+
const sharedProperties = ['classification', 'disableFlows', 'socialBarOnSitePagesDisabled', 'shareByEmailEnabled', 'sharingCapability', 'noScriptSite'];
|
|
303
|
+
const siteProperties = ['title', 'resourceQuota', 'resourceQuotaWarningLevel', 'storageQuota', 'storageQuotaWarningLevel', 'allowSelfServiceUpgrade'];
|
|
304
|
+
let properties = sharedProperties;
|
|
305
|
+
if (!isGroupConnectedSite) {
|
|
306
|
+
properties = properties.concat(siteProperties);
|
|
326
307
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
308
|
+
let updatedProperties = false;
|
|
309
|
+
for (let i = 0; i < properties.length; i++) {
|
|
310
|
+
if (typeof args.options[properties[i]] !== 'undefined') {
|
|
311
|
+
updatedProperties = true;
|
|
312
|
+
break;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (!updatedProperties) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
this.context = yield spo_1.spo.ensureFormDigest(this.spoAdminUrl, logger, this.context, this.debug);
|
|
335
319
|
if (this.verbose) {
|
|
336
320
|
logger.logToStderr(`Updating site ${args.options.url} properties...`);
|
|
337
321
|
}
|
|
338
322
|
let propertyId = 27;
|
|
339
323
|
const payload = [];
|
|
324
|
+
const sitePropertiesPayload = [];
|
|
340
325
|
if (!isGroupConnectedSite) {
|
|
341
326
|
if (args.options.title) {
|
|
342
327
|
payload.push(`<SetProperty Id="${propertyId++}" ObjectPathId="5" Name="Title"><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.title)}</Parameter></SetProperty>`);
|
|
@@ -353,74 +338,90 @@ class SpoSiteSetCommand extends SpoCommand_1.default {
|
|
|
353
338
|
if (args.options.storageQuotaWarningLevel) {
|
|
354
339
|
payload.push(`<SetProperty Id="${propertyId++}" ObjectPathId="5" Name="StorageWarningLevel"><Parameter Type="Int64">${args.options.storageQuotaWarningLevel}</Parameter></SetProperty>`);
|
|
355
340
|
}
|
|
356
|
-
if (
|
|
341
|
+
if (args.options.allowSelfServiceUpgrade !== undefined) {
|
|
357
342
|
payload.push(`<SetProperty Id="${propertyId++}" ObjectPathId="5" Name="AllowSelfServiceUpgrade"><Parameter Type="Boolean">${args.options.allowSelfServiceUpgrade}</Parameter></SetProperty>`);
|
|
358
343
|
}
|
|
359
344
|
}
|
|
360
345
|
if (typeof args.options.classification === 'string') {
|
|
361
|
-
|
|
346
|
+
sitePropertiesPayload.push(`<SetProperty Id="${propertyId++}" ObjectPathId="5" Name="Classification"><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.classification)}</Parameter></SetProperty>`);
|
|
362
347
|
}
|
|
363
|
-
if (
|
|
364
|
-
|
|
348
|
+
if (args.options.disableFlows !== undefined) {
|
|
349
|
+
const flowsPolicy = args.options.disableFlows ? FlowsPolicy_1.FlowsPolicy.Disabled : FlowsPolicy_1.FlowsPolicy.Enabled;
|
|
350
|
+
payload.push(`<SetProperty Id="${propertyId++}" ObjectPathId="5" Name="DisableFlows"><Parameter Type="Enum">${flowsPolicy}</Parameter></SetProperty>`);
|
|
365
351
|
}
|
|
366
352
|
if (typeof args.options.socialBarOnSitePagesDisabled !== 'undefined') {
|
|
367
353
|
payload.push(`<SetProperty Id="${propertyId++}" ObjectPathId="5" Name="SocialBarOnSitePagesDisabled"><Parameter Type="Boolean">${args.options.socialBarOnSitePagesDisabled}</Parameter></SetProperty>`);
|
|
368
354
|
}
|
|
369
|
-
if (
|
|
370
|
-
|
|
355
|
+
if (args.options.shareByEmailEnabled !== undefined) {
|
|
356
|
+
sitePropertiesPayload.push(`<SetProperty Id="${propertyId++}" ObjectPathId="5" Name="ShareByEmailEnabled"><Parameter Type="Boolean">${args.options.shareByEmailEnabled}</Parameter></SetProperty>`);
|
|
371
357
|
}
|
|
372
358
|
if (args.options.sharingCapability) {
|
|
373
359
|
const sharingCapability = SharingCapabilities_1.SharingCapabilities[args.options.sharingCapability];
|
|
374
360
|
payload.push(`<SetProperty Id="${propertyId++}" ObjectPathId="5" Name="SharingCapability"><Parameter Type="Enum">${sharingCapability}</Parameter></SetProperty>`);
|
|
375
361
|
}
|
|
376
|
-
if (
|
|
362
|
+
if (args.options.noScriptSite !== undefined) {
|
|
377
363
|
const noScriptSite = args.options.noScriptSite ? 2 : 1;
|
|
378
364
|
payload.push(`<SetProperty Id="${propertyId++}" ObjectPathId="5" Name="DenyAddAndCustomizePages"><Parameter Type="Enum">${noScriptSite}</Parameter></SetProperty>`);
|
|
379
365
|
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
366
|
+
let response;
|
|
367
|
+
let sitePropertiesResponse;
|
|
368
|
+
if (sitePropertiesPayload.length > 0) {
|
|
369
|
+
const requestOptions = {
|
|
370
|
+
url: `${args.options.url}/_vti_bin/client.svc/ProcessQuery`,
|
|
371
|
+
headers: {
|
|
372
|
+
'X-RequestDigest': this.context.FormDigestValue
|
|
373
|
+
},
|
|
374
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions>${sitePropertiesPayload.join('')}</Actions><ObjectPaths><StaticProperty Id="1" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" /><Property Id="5" ParentId="1" Name="Site" /></ObjectPaths></Request>`
|
|
375
|
+
};
|
|
376
|
+
sitePropertiesResponse = yield request_1.default.post(requestOptions);
|
|
377
|
+
}
|
|
378
|
+
if (payload.length > 0) {
|
|
379
|
+
const pos = this.tenantId.indexOf('|') + 1;
|
|
380
|
+
const requestOptions = {
|
|
381
|
+
url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
382
|
+
headers: {
|
|
383
|
+
'X-RequestDigest': this.context.FormDigestValue
|
|
384
|
+
},
|
|
385
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions>${payload.join('')}<ObjectPath Id="14" ObjectPathId="13" /><ObjectIdentityQuery Id="15" ObjectPathId="5" /><Query Id="16" ObjectPathId="13"><Query SelectAllProperties="false"><Properties><Property Name="IsComplete" ScalarProperty="true" /><Property Name="PollingInterval" ScalarProperty="true" /></Properties></Query></Query></Actions><ObjectPaths><Identity Id="5" Name="53d8499e-d0d2-5000-cb83-9ade5be42ca4|${this.tenantId.substr(pos, this.tenantId.indexOf('&') - pos)}
SiteProperties
${formatting_1.formatting.encodeQueryParameter(args.options.url)}" /><Method Id="13" ParentId="5" Name="Update" /></ObjectPaths></Request>`
|
|
386
|
+
};
|
|
387
|
+
response = yield request_1.default.post(requestOptions);
|
|
388
|
+
}
|
|
389
|
+
return response || sitePropertiesResponse;
|
|
389
390
|
});
|
|
390
391
|
}
|
|
391
392
|
applySiteDesign(logger, args) {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
393
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
394
|
+
if (typeof args.options.siteDesignId === 'undefined') {
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
const options = {
|
|
398
|
+
webUrl: args.options.url,
|
|
399
|
+
id: args.options.siteDesignId,
|
|
400
|
+
asTask: false,
|
|
401
|
+
debug: this.debug,
|
|
402
|
+
verbose: this.verbose
|
|
403
|
+
};
|
|
404
|
+
return Cli_1.Cli.executeCommand(spoSiteDesignApplyCommand, { options: Object.assign(Object.assign({}, options), { _: [] }) });
|
|
405
|
+
});
|
|
403
406
|
}
|
|
404
407
|
loadSiteIds(siteUrl, logger) {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
.get(requestOptions)
|
|
417
|
-
.then((siteInfo) => {
|
|
408
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
409
|
+
if (this.debug) {
|
|
410
|
+
logger.logToStderr('Loading site IDs...');
|
|
411
|
+
}
|
|
412
|
+
const requestOptions = {
|
|
413
|
+
url: `${siteUrl}/_api/site?$select=GroupId,Id`,
|
|
414
|
+
headers: {
|
|
415
|
+
accept: 'application/json;odata=nometadata'
|
|
416
|
+
},
|
|
417
|
+
responseType: 'json'
|
|
418
|
+
};
|
|
419
|
+
const siteInfo = yield request_1.default.get(requestOptions);
|
|
418
420
|
this.groupId = siteInfo.GroupId;
|
|
419
421
|
this.siteId = siteInfo.Id;
|
|
420
422
|
if (this.debug) {
|
|
421
423
|
logger.logToStderr(`Retrieved site IDs. siteId: ${this.siteId}, groupId: ${this.groupId}`);
|
|
422
424
|
}
|
|
423
|
-
return Promise.resolve();
|
|
424
425
|
});
|
|
425
426
|
}
|
|
426
427
|
isGroupConnectedSite() {
|
|
@@ -35,30 +35,8 @@ class SpoThemeRemoveCommand extends SpoCommand_1.default {
|
|
|
35
35
|
}
|
|
36
36
|
commandAction(logger, args) {
|
|
37
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
const removeTheme = () => __awaiter(this, void 0, void 0, function* () {
|
|
39
|
-
try {
|
|
40
|
-
const spoAdminUrl = yield spo_1.spo.getSpoAdminUrl(logger, this.debug);
|
|
41
|
-
if (this.verbose) {
|
|
42
|
-
logger.logToStderr(`Removing theme from tenant...`);
|
|
43
|
-
}
|
|
44
|
-
const requestOptions = {
|
|
45
|
-
url: `${spoAdminUrl}/_api/thememanager/DeleteTenantTheme`,
|
|
46
|
-
headers: {
|
|
47
|
-
'accept': 'application/json;odata=nometadata'
|
|
48
|
-
},
|
|
49
|
-
data: {
|
|
50
|
-
name: args.options.name
|
|
51
|
-
},
|
|
52
|
-
responseType: 'json'
|
|
53
|
-
};
|
|
54
|
-
yield request_1.default.post(requestOptions);
|
|
55
|
-
}
|
|
56
|
-
catch (err) {
|
|
57
|
-
this.handleRejectedODataJsonPromise(err);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
38
|
if (args.options.confirm) {
|
|
61
|
-
yield removeTheme();
|
|
39
|
+
yield this.removeTheme(logger, args.options);
|
|
62
40
|
}
|
|
63
41
|
else {
|
|
64
42
|
const result = yield Cli_1.Cli.prompt({
|
|
@@ -68,8 +46,32 @@ class SpoThemeRemoveCommand extends SpoCommand_1.default {
|
|
|
68
46
|
message: `Are you sure you want to remove the theme`
|
|
69
47
|
});
|
|
70
48
|
if (result.continue) {
|
|
71
|
-
yield removeTheme();
|
|
49
|
+
yield this.removeTheme(logger, args.options);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
removeTheme(logger, options) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
try {
|
|
57
|
+
const spoAdminUrl = yield spo_1.spo.getSpoAdminUrl(logger, this.debug);
|
|
58
|
+
if (this.verbose) {
|
|
59
|
+
logger.logToStderr(`Removing theme from tenant...`);
|
|
72
60
|
}
|
|
61
|
+
const requestOptions = {
|
|
62
|
+
url: `${spoAdminUrl}/_api/thememanager/DeleteTenantTheme`,
|
|
63
|
+
headers: {
|
|
64
|
+
'accept': 'application/json;odata=nometadata'
|
|
65
|
+
},
|
|
66
|
+
data: {
|
|
67
|
+
name: options.name
|
|
68
|
+
},
|
|
69
|
+
responseType: 'json'
|
|
70
|
+
};
|
|
71
|
+
yield request_1.default.post(requestOptions);
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
this.handleRejectedODataJsonPromise(err);
|
|
73
75
|
}
|
|
74
76
|
});
|
|
75
77
|
}
|
|
@@ -38,33 +38,8 @@ class SpoUserRemoveCommand extends SpoCommand_1.default {
|
|
|
38
38
|
}
|
|
39
39
|
commandAction(logger, args) {
|
|
40
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
const removeUser = () => __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
if (this.verbose) {
|
|
43
|
-
logger.logToStderr(`Removing user from subsite ${args.options.webUrl} ...`);
|
|
44
|
-
}
|
|
45
|
-
let requestUrl = '';
|
|
46
|
-
if (args.options.id) {
|
|
47
|
-
requestUrl = `${encodeURI(args.options.webUrl)}/_api/web/siteusers/removebyid(${args.options.id})`;
|
|
48
|
-
}
|
|
49
|
-
if (args.options.loginName) {
|
|
50
|
-
requestUrl = `${encodeURI(args.options.webUrl)}/_api/web/siteusers/removeByLoginName('${formatting_1.formatting.encodeQueryParameter(args.options.loginName)}')`;
|
|
51
|
-
}
|
|
52
|
-
const requestOptions = {
|
|
53
|
-
url: requestUrl,
|
|
54
|
-
headers: {
|
|
55
|
-
accept: 'application/json;odata=nometadata'
|
|
56
|
-
},
|
|
57
|
-
responseType: 'json'
|
|
58
|
-
};
|
|
59
|
-
try {
|
|
60
|
-
yield request_1.default.post(requestOptions);
|
|
61
|
-
}
|
|
62
|
-
catch (err) {
|
|
63
|
-
this.handleRejectedODataJsonPromise(err);
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
41
|
if (args.options.confirm) {
|
|
67
|
-
yield removeUser();
|
|
42
|
+
yield this.removeUser(logger, args.options);
|
|
68
43
|
}
|
|
69
44
|
else {
|
|
70
45
|
const result = yield Cli_1.Cli.prompt({
|
|
@@ -74,11 +49,38 @@ class SpoUserRemoveCommand extends SpoCommand_1.default {
|
|
|
74
49
|
message: `Are you sure you want to remove specified user from the site ${args.options.webUrl}`
|
|
75
50
|
});
|
|
76
51
|
if (result.continue) {
|
|
77
|
-
yield removeUser();
|
|
52
|
+
yield this.removeUser(logger, args.options);
|
|
78
53
|
}
|
|
79
54
|
}
|
|
80
55
|
});
|
|
81
56
|
}
|
|
57
|
+
removeUser(logger, options) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
if (this.verbose) {
|
|
60
|
+
logger.logToStderr(`Removing user from subsite ${options.webUrl} ...`);
|
|
61
|
+
}
|
|
62
|
+
let requestUrl = `${encodeURI(options.webUrl)}/_api/web/siteusers/`;
|
|
63
|
+
if (options.id) {
|
|
64
|
+
requestUrl += `removebyid(${options.id})`;
|
|
65
|
+
}
|
|
66
|
+
else if (options.loginName) {
|
|
67
|
+
requestUrl += `removeByLoginName('${formatting_1.formatting.encodeQueryParameter(options.loginName)}')`;
|
|
68
|
+
}
|
|
69
|
+
const requestOptions = {
|
|
70
|
+
url: requestUrl,
|
|
71
|
+
headers: {
|
|
72
|
+
accept: 'application/json;odata=nometadata'
|
|
73
|
+
},
|
|
74
|
+
responseType: 'json'
|
|
75
|
+
};
|
|
76
|
+
try {
|
|
77
|
+
yield request_1.default.post(requestOptions);
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
this.handleRejectedODataJsonPromise(err);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
82
84
|
}
|
|
83
85
|
_SpoUserRemoveCommand_instances = new WeakSet(), _SpoUserRemoveCommand_initTelemetry = function _SpoUserRemoveCommand_initTelemetry() {
|
|
84
86
|
this.telemetry.push((args) => {
|