@pnp/cli-microsoft365 6.9.0-beta.1cd2525 → 6.9.0-beta.3158148
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/.devcontainer/Dockerfile +12 -19
- package/.devcontainer/devcontainer.json +24 -17
- package/Dockerfile +3 -1
- package/dist/Auth.js +2 -8
- package/dist/AuthServer.js +2 -4
- package/dist/cli/Cli.js +2 -2
- package/dist/m365/aad/commands/app/app-add.js +258 -249
- package/dist/m365/aad/commands/app/app-get.js +65 -62
- package/dist/m365/aad/commands/app/app-remove.js +22 -23
- package/dist/m365/aad/commands/app/app-role-add.js +35 -34
- package/dist/m365/aad/commands/app/app-role-list.js +22 -23
- package/dist/m365/aad/commands/app/app-role-remove.js +76 -73
- package/dist/m365/aad/commands/app/app-set.js +103 -103
- package/dist/m365/aad/commands/approleassignment/approleassignment-add.js +16 -14
- package/dist/m365/aad/commands/approleassignment/approleassignment-list.js +43 -52
- package/dist/m365/aad/commands/approleassignment/approleassignment-remove.js +20 -16
- package/dist/m365/aad/commands/o365group/o365group-add.js +40 -37
- package/dist/m365/aad/commands/o365group/o365group-conversation-post-list.js +7 -6
- package/dist/m365/aad/commands/o365group/o365group-list.js +6 -11
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-clear.js +7 -8
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-restore.js +23 -24
- package/dist/m365/aad/commands/o365group/o365group-set.js +15 -20
- package/dist/m365/aad/commands/o365group/o365group-teamify.js +15 -16
- package/dist/m365/aad/commands/o365group/o365group-user-list.js +17 -10
- package/dist/m365/aad/commands/o365group/o365group-user-set.js +17 -10
- package/dist/m365/aad/commands/policy/policy-list.js +12 -13
- package/dist/m365/aad/commands/siteclassification/siteclassification-enable.js +1 -3
- package/dist/m365/aad/commands/siteclassification/siteclassification-set.js +19 -20
- package/dist/m365/aad/commands/sp/sp-add.js +22 -23
- package/dist/m365/aad/commands/sp/sp-get.js +22 -23
- package/dist/m365/aad/commands/sp/sp-list.js +78 -0
- package/dist/m365/aad/commands.js +1 -0
- package/dist/m365/app/commands/app-open.js +4 -14
- package/dist/m365/base/AzmgmtItemsListCommand.js +31 -33
- package/dist/m365/cli/commands/cli-issue.js +4 -10
- package/dist/m365/cli/commands/cli-reconsent.js +2 -8
- package/dist/m365/cli/commands/config/config-set.js +0 -1
- package/dist/m365/commands/docs.js +2 -8
- package/dist/m365/commands/login.js +20 -0
- package/dist/m365/flow/commands/flow-list.js +30 -12
- package/dist/m365/flow/commands/flow-remove.js +2 -3
- package/dist/m365/flow/commands/run/run-resubmit.js +11 -10
- package/dist/m365/onedrive/commands/onedrive-list.js +21 -32
- package/dist/m365/outlook/commands/message/message-list.js +18 -23
- package/dist/m365/outlook/commands/message/message-move.js +15 -20
- package/dist/m365/pa/commands/app/app-export.js +3 -4
- package/dist/m365/pa/commands/app/app-get.js +11 -9
- package/dist/m365/pa/commands/app/app-remove.js +1 -1
- package/dist/m365/pa/commands/pcf/pcf-init.js +1 -2
- package/dist/m365/pa/commands/solution/solution-init.js +1 -2
- package/dist/m365/pa/commands/solution/solution-reference-add.js +1 -2
- package/dist/m365/pp/commands/managementapp/managementapp-add.js +19 -20
- package/dist/m365/purview/commands/retentionevent/retentionevent-add.js +3 -3
- package/dist/m365/purview/commands/retentionevent/retentionevent-get.js +1 -1
- package/dist/m365/purview/commands/retentionevent/retentionevent-list.js +1 -1
- package/dist/m365/purview/commands/retentionevent/retentionevent-remove.js +1 -1
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-add.js +1 -1
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-get.js +1 -1
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-list.js +1 -1
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-remove.js +1 -1
- package/dist/m365/purview/commands/retentioneventtype/retentioneventtype-set.js +1 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.17.3.js +25 -0
- package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002027_DEVDEP_fluentui_react.js +14 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.17.3.js +59 -0
- package/dist/m365/spfx/commands/project/project-upgrade.js +2 -1
- package/dist/m365/spfx/commands/spfx-doctor.js +15 -0
- package/dist/m365/spo/commands/app/app-teamspackage-download.js +17 -24
- package/dist/m365/spo/commands/apppage/apppage-set.js +1 -1
- package/dist/m365/spo/commands/contenttype/contenttype-field-set.js +65 -94
- package/dist/m365/spo/commands/customaction/customaction-clear.js +4 -12
- package/dist/m365/spo/commands/customaction/customaction-remove.js +12 -23
- package/dist/m365/spo/commands/customaction/customaction-set.js +21 -29
- package/dist/m365/spo/commands/file/file-add.js +133 -133
- package/dist/m365/spo/commands/file/file-checkout-undo.js +119 -0
- package/dist/m365/spo/commands/file/file-rename.js +11 -9
- package/dist/m365/spo/commands/file/file-retentionlabel-ensure.js +2 -2
- package/dist/m365/spo/commands/file/file-roleassignment-add.js +41 -61
- package/dist/m365/spo/commands/file/file-roleassignment-remove.js +3 -0
- package/dist/m365/spo/commands/file/file-roleinheritance-break.js +3 -0
- package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +3 -0
- package/dist/m365/spo/commands/file/file-sharinginfo-get.js +23 -21
- package/dist/m365/spo/commands/file/file-version-clear.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-roleassignment-add.js +3 -3
- package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +1 -1
- package/dist/m365/spo/commands/group/group-member-add.js +17 -16
- package/dist/m365/spo/commands/group/group-set.js +20 -20
- package/dist/m365/spo/commands/homesite/homesite-remove.js +1 -1
- package/dist/m365/spo/commands/hubsite/hubsite-get.js +33 -31
- package/dist/m365/spo/commands/hubsite/hubsite-list.js +18 -29
- package/dist/m365/spo/commands/hubsite/hubsite-unregister.js +3 -0
- package/dist/m365/spo/commands/list/list-add.js +1 -1
- package/dist/m365/spo/commands/list/list-contenttype-default-set.js +1 -1
- package/dist/m365/spo/commands/list/list-roleassignment-add.js +45 -52
- package/dist/m365/spo/commands/list/list-roleassignment-remove.js +33 -38
- package/dist/m365/spo/commands/list/list-sensitivitylabel-ensure.js +13 -3
- package/dist/m365/spo/commands/list/list-view-field-add.js +12 -10
- package/dist/m365/spo/commands/list/list-view-field-remove.js +12 -10
- package/dist/m365/spo/commands/list/list-view-field-set.js +12 -10
- package/dist/m365/spo/commands/list/list-view-remove.js +3 -0
- package/dist/m365/spo/commands/listitem/listitem-roleassignment-add.js +41 -61
- package/dist/m365/spo/commands/listitem/listitem-roleassignment-remove.js +71 -74
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +36 -34
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +32 -30
- package/dist/m365/spo/commands/navigation/navigation-node-remove.js +24 -22
- package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-remove.js +29 -27
- package/dist/m365/spo/commands/orgnewssite/orgnewssite-remove.js +26 -24
- package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +34 -40
- package/dist/m365/spo/commands/sitedesign/sitedesign-task-remove.js +23 -21
- package/dist/m365/spo/commands/sitescript/sitescript-remove.js +24 -22
- package/dist/m365/spo/commands/spo-search.js +7 -15
- package/dist/m365/spo/commands/storageentity/storageentity-remove.js +29 -27
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-set.js +156 -0
- package/dist/m365/spo/commands.js +2 -0
- package/dist/m365/teams/commands/app/app-install.js +23 -21
- package/dist/m365/teams/commands/app/app-remove.js +3 -0
- package/dist/m365/teams/commands/app/app-uninstall.js +3 -0
- package/dist/m365/teams/commands/app/app-update.js +15 -16
- package/dist/m365/teams/commands/channel/channel-add.js +40 -39
- package/dist/m365/teams/commands/channel/channel-get.js +23 -25
- package/dist/m365/teams/commands/channel/channel-list.js +6 -7
- package/dist/m365/teams/commands/channel/channel-member-add.js +61 -60
- package/dist/m365/teams/commands/channel/channel-member-list.js +20 -22
- package/dist/m365/teams/commands/channel/channel-member-remove.js +43 -48
- package/dist/m365/teams/commands/channel/channel-member-set.js +36 -39
- package/dist/m365/teams/commands/channel/channel-remove.js +4 -1
- package/dist/m365/teams/commands/funsettings/funsettings-list.js +3 -0
- package/dist/m365/teams/commands/funsettings/funsettings-set.js +3 -0
- package/dist/m365/teams/commands/tab/tab-get.js +34 -37
- package/dist/m365/teams/commands/team/team-archive.js +6 -7
- package/dist/m365/teams/commands/team/team-get.js +6 -7
- package/dist/m365/teams/commands/team/team-list.js +9 -11
- package/dist/m365/teams/commands/team/team-remove.js +6 -7
- package/dist/m365/teams/commands/team/team-unarchive.js +6 -7
- package/dist/m365/teams/commands/user/user-app-list.js +13 -11
- package/dist/m365/teams/commands/user/user-list.js +7 -4
- package/dist/m365/tenant/commands/security/security-alerts-list.js +25 -26
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-health-list.js +13 -14
- package/dist/m365/todo/commands/list/list-remove.js +39 -36
- package/dist/m365/todo/commands/list/list-set.js +16 -14
- package/dist/m365/todo/commands/task/task-add.js +14 -14
- package/dist/m365/util/commands/accesstoken/accesstoken-get.js +10 -7
- package/dist/settingsNames.js +0 -1
- package/dist/utils/browserUtil.js +23 -0
- package/docs/docs/cmd/aad/sp/sp-list.mdx +162 -0
- package/docs/docs/cmd/flow/flow-list.mdx +15 -0
- package/docs/docs/cmd/login.mdx +39 -0
- package/docs/docs/cmd/setup.mdx +2 -0
- package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-checkout-undo.mdx +55 -0
- package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +1 -1
- package/docs/docs/cmd/spo/list/list-sensitivitylabel-ensure.mdx +14 -5
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-set.mdx +81 -0
- package/docs/docs/cmd/spo/tenant/tenant-settings-set.mdx +6 -0
- package/docs/docs/cmd/status.mdx +6 -3
- package/docs/docs/cmd/util/accesstoken/accesstoken-get.mdx +12 -2
- package/npm-shrinkwrap.json +299 -272
- package/package.json +17 -17
- package/dist/m365/aad/commands/approleassignment/AppRoleAssignment.js +0 -3
- package/dist/m365/aad/commands/approleassignment/ServicePrincipal.js +0 -3
- package/dist/m365/aad/commands/groupsetting/GroupSetting.js +0 -3
- package/dist/m365/aad/commands/groupsettingtemplate/GroupSettingTemplate.js +0 -3
- package/dist/m365/aad/commands/siteclassification/DirectorySetting.js +0 -10
- package/dist/m365/aad/commands/siteclassification/DirectorySettingTemplatesRsp.js +0 -3
- package/dist/m365/aad/commands/siteclassification/DirectorySettingValue.js +0 -3
- package/dist/m365/outlook/Message.js +0 -3
- package/dist/m365/spo/commands/site/SitePermission.js +0 -3
- package/dist/m365/teams/Channel.js +0 -3
- package/dist/m365/teams/ConversationMember.js +0 -3
- package/dist/m365/teams/Message.js +0 -3
- package/dist/m365/teams/Reply.js +0 -3
- package/dist/m365/teams/Tab.js +0 -3
- package/dist/m365/teams/Team.js +0 -3
- package/dist/m365/teams/TeamsApp.js +0 -3
- package/dist/m365/teams/TeamsAppInstallation.js +0 -3
- package/dist/m365/teams/TeamsTabConfiguration.js +0 -3
- package/dist/m365/teams/commands/Meeting.js +0 -3
|
@@ -170,7 +170,7 @@ class SpoContentTypeFieldSetCommand extends SpoCommand_1.default {
|
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
createFieldLink(logger, args, schemaXmlWithResourceTokens) {
|
|
173
|
-
return
|
|
173
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
174
174
|
let requiresUpdate = false;
|
|
175
175
|
const match = /(<Field[^>]+>)(.*)/.exec(schemaXmlWithResourceTokens);
|
|
176
176
|
let xField = match[1];
|
|
@@ -185,120 +185,91 @@ class SpoContentTypeFieldSetCommand extends SpoCommand_1.default {
|
|
|
185
185
|
xField = xField.replace(allowDeletion[0], 'AllowDeletion="TRUE"') + match[2];
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
this
|
|
189
|
-
|
|
190
|
-
.
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
})
|
|
231
|
-
.then((res) => {
|
|
232
|
-
const json = JSON.parse(res);
|
|
233
|
-
const response = json[0];
|
|
234
|
-
if (response.ErrorInfo) {
|
|
235
|
-
reject(response.ErrorInfo.ErrorMessage);
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
resolve();
|
|
239
|
-
}
|
|
240
|
-
}, (error) => {
|
|
241
|
-
reject(error);
|
|
242
|
-
});
|
|
188
|
+
yield this.updateField(xField, requiresUpdate, logger, args);
|
|
189
|
+
if (this.verbose) {
|
|
190
|
+
logger.logToStderr(`Retrieving site collection id...`);
|
|
191
|
+
}
|
|
192
|
+
const requestOptionsSiteId = {
|
|
193
|
+
url: `${args.options.webUrl}/_api/site?$select=Id`,
|
|
194
|
+
headers: {
|
|
195
|
+
accept: 'application/json;odata=nometadata'
|
|
196
|
+
},
|
|
197
|
+
responseType: 'json'
|
|
198
|
+
};
|
|
199
|
+
const resSiteId = yield request_1.default.get(requestOptionsSiteId);
|
|
200
|
+
this.siteId = resSiteId.Id;
|
|
201
|
+
if (this.verbose) {
|
|
202
|
+
logger.logToStderr(`Retrieving site id...`);
|
|
203
|
+
}
|
|
204
|
+
const requestOptionsWebId = {
|
|
205
|
+
url: `${args.options.webUrl}/_api/web?$select=Id`,
|
|
206
|
+
headers: {
|
|
207
|
+
accept: 'application/json;odata=nometadata'
|
|
208
|
+
},
|
|
209
|
+
responseType: 'json'
|
|
210
|
+
};
|
|
211
|
+
const resWebId = yield request_1.default.get(requestOptionsWebId);
|
|
212
|
+
this.webId = resWebId.Id;
|
|
213
|
+
yield this.ensureRequestDigest(args.options.webUrl, logger);
|
|
214
|
+
const requestOptions = {
|
|
215
|
+
url: `${args.options.webUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
216
|
+
headers: {
|
|
217
|
+
'X-RequestDigest': this.requestDigest
|
|
218
|
+
},
|
|
219
|
+
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="5" ObjectPathId="4" /><ObjectIdentityQuery Id="6" ObjectPathId="4" /><Method Name="Update" Id="7" ObjectPathId="1"><Parameters><Parameter Type="Boolean">true</Parameter></Parameters></Method></Actions><ObjectPaths><Identity Id="2" Name="d6667b9e-50fb-0000-2693-032ae7a0df25|740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${this.siteId}:web:${this.webId}:field:${args.options.id}" /><Method Id="4" ParentId="3" Name="Add"><Parameters><Parameter TypeId="{63fb2c92-8f65-4bbb-a658-b6cd294403f4}"><Property Name="Field" ObjectPathId="2" /></Parameter></Parameters></Method><Identity Id="1" Name="d6667b9e-80f4-0000-2693-05528ff416bf|740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${this.siteId}:web:${this.webId}:contenttype:${formatting_1.formatting.escapeXml(args.options.contentTypeId)}" /><Property Id="3" ParentId="1" Name="FieldLinks" /></ObjectPaths></Request>`
|
|
220
|
+
};
|
|
221
|
+
const res = yield request_1.default.post(requestOptions);
|
|
222
|
+
const json = JSON.parse(res);
|
|
223
|
+
const response = json[0];
|
|
224
|
+
if (response.ErrorInfo) {
|
|
225
|
+
throw response.ErrorInfo.ErrorMessage;
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
243
230
|
});
|
|
244
231
|
}
|
|
245
232
|
updateField(schemaXml, requiresUpdate, logger, args) {
|
|
246
|
-
return
|
|
233
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
247
234
|
if (!requiresUpdate) {
|
|
248
235
|
if (this.verbose) {
|
|
249
236
|
logger.logToStderr(`Schema of field ${args.options.id} is already up-to-date`);
|
|
250
237
|
}
|
|
251
|
-
resolve();
|
|
252
238
|
return;
|
|
253
239
|
}
|
|
254
|
-
this
|
|
255
|
-
|
|
256
|
-
.
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
};
|
|
273
|
-
return request_1.default.post(requestOptions);
|
|
274
|
-
})
|
|
275
|
-
.then(() => {
|
|
276
|
-
resolve();
|
|
277
|
-
}, (error) => {
|
|
278
|
-
reject(error);
|
|
279
|
-
});
|
|
240
|
+
yield this.ensureRequestDigest(args.options.webUrl, logger);
|
|
241
|
+
if (this.verbose) {
|
|
242
|
+
logger.logToStderr(`Updating field schema...`);
|
|
243
|
+
}
|
|
244
|
+
const requestOptions = {
|
|
245
|
+
url: `${args.options.webUrl}/_api/web/fields('${args.options.id}')`,
|
|
246
|
+
headers: {
|
|
247
|
+
accept: 'application/json;odata=nometadata',
|
|
248
|
+
'content-type': 'application/json;odata=nometadata',
|
|
249
|
+
'X-HTTP-Method': 'MERGE',
|
|
250
|
+
'x-requestdigest': this.requestDigest
|
|
251
|
+
},
|
|
252
|
+
data: {
|
|
253
|
+
SchemaXml: schemaXml
|
|
254
|
+
},
|
|
255
|
+
responseType: 'json'
|
|
256
|
+
};
|
|
257
|
+
yield request_1.default.post(requestOptions);
|
|
280
258
|
});
|
|
281
259
|
}
|
|
282
260
|
ensureRequestDigest(siteUrl, logger) {
|
|
283
|
-
return
|
|
261
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
284
262
|
if (this.requestDigest) {
|
|
285
263
|
if (this.debug) {
|
|
286
264
|
logger.logToStderr('Request digest already present');
|
|
287
265
|
}
|
|
288
|
-
resolve();
|
|
289
266
|
return;
|
|
290
267
|
}
|
|
291
268
|
if (this.debug) {
|
|
292
269
|
logger.logToStderr('Retrieving request digest...');
|
|
293
270
|
}
|
|
294
|
-
spo_1.spo
|
|
295
|
-
|
|
296
|
-
.then((res) => {
|
|
297
|
-
this.requestDigest = res.FormDigestValue;
|
|
298
|
-
resolve();
|
|
299
|
-
}, (error) => {
|
|
300
|
-
reject(error);
|
|
301
|
-
});
|
|
271
|
+
const res = yield spo_1.spo.getRequestDigest(siteUrl);
|
|
272
|
+
this.requestDigest = res.FormDigestValue;
|
|
302
273
|
});
|
|
303
274
|
}
|
|
304
275
|
}
|
|
@@ -81,19 +81,11 @@ class SpoCustomActionClearCommand extends SpoCommand_1.default {
|
|
|
81
81
|
* Another clear request is send with `site` scope after.
|
|
82
82
|
*/
|
|
83
83
|
clearAllScopes(options) {
|
|
84
|
-
return
|
|
84
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
85
85
|
options.scope = "Web";
|
|
86
|
-
this
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
options.scope = "Site";
|
|
90
|
-
return this.clearScopedCustomActions(options);
|
|
91
|
-
})
|
|
92
|
-
.then(() => {
|
|
93
|
-
return resolve();
|
|
94
|
-
}, (err) => {
|
|
95
|
-
reject(err);
|
|
96
|
-
});
|
|
86
|
+
yield this.clearScopedCustomActions(options);
|
|
87
|
+
options.scope = "Site";
|
|
88
|
+
yield this.clearScopedCustomActions(options);
|
|
97
89
|
});
|
|
98
90
|
}
|
|
99
91
|
}
|
|
@@ -77,7 +77,7 @@ class SpoCustomActionRemoveCommand extends SpoCommand_1.default {
|
|
|
77
77
|
getCustomActionId(options) {
|
|
78
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
79
|
if (options.id) {
|
|
80
|
-
return
|
|
80
|
+
return options.id;
|
|
81
81
|
}
|
|
82
82
|
const customActions = yield spo_1.spo.getCustomActions(options.webUrl, options.scope, `Title eq '${formatting_1.formatting.encodeQueryParameter(options.title)}'`);
|
|
83
83
|
if (customActions.length === 1) {
|
|
@@ -90,9 +90,8 @@ class SpoCustomActionRemoveCommand extends SpoCommand_1.default {
|
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
removeScopedCustomAction(options) {
|
|
93
|
-
return this
|
|
94
|
-
.getCustomActionId(options)
|
|
95
|
-
.then((customActionId) => {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
const customActionId = yield this.getCustomActionId(options);
|
|
96
95
|
const requestOptions = {
|
|
97
96
|
url: `${options.webUrl}/_api/${options.scope}/UserCustomActions('${formatting_1.formatting.encodeQueryParameter(customActionId)}')')`,
|
|
98
97
|
headers: {
|
|
@@ -101,7 +100,7 @@ class SpoCustomActionRemoveCommand extends SpoCommand_1.default {
|
|
|
101
100
|
},
|
|
102
101
|
responseType: 'json'
|
|
103
102
|
};
|
|
104
|
-
return request_1.default.post(requestOptions);
|
|
103
|
+
return yield request_1.default.post(requestOptions);
|
|
105
104
|
});
|
|
106
105
|
}
|
|
107
106
|
/**
|
|
@@ -110,25 +109,15 @@ class SpoCustomActionRemoveCommand extends SpoCommand_1.default {
|
|
|
110
109
|
* another get request is send with `site` scope.
|
|
111
110
|
*/
|
|
112
111
|
searchAllScopes(options) {
|
|
113
|
-
return
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
114
113
|
options.scope = "Web";
|
|
115
|
-
this
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
this
|
|
123
|
-
.removeScopedCustomAction(options)
|
|
124
|
-
.then((siteResult) => {
|
|
125
|
-
return resolve(siteResult);
|
|
126
|
-
}, (err) => {
|
|
127
|
-
reject(err);
|
|
128
|
-
});
|
|
129
|
-
}, (err) => {
|
|
130
|
-
reject(err);
|
|
131
|
-
});
|
|
114
|
+
const webResult = yield this.removeScopedCustomAction(options);
|
|
115
|
+
if (!webResult) {
|
|
116
|
+
return webResult;
|
|
117
|
+
}
|
|
118
|
+
options.scope = "Site";
|
|
119
|
+
const siteResult = yield this.removeScopedCustomAction(options);
|
|
120
|
+
return siteResult;
|
|
132
121
|
});
|
|
133
122
|
}
|
|
134
123
|
}
|
|
@@ -73,17 +73,19 @@ class SpoCustomActionSetCommand extends SpoCommand_1.default {
|
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
updateCustomAction(options) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const requestBody = this.mapRequestBody(options);
|
|
78
|
+
const requestOptions = {
|
|
79
|
+
url: `${options.webUrl}/_api/${options.scope}/UserCustomActions('${formatting_1.formatting.encodeQueryParameter(options.id)}')`,
|
|
80
|
+
headers: {
|
|
81
|
+
accept: 'application/json;odata=nometadata',
|
|
82
|
+
'X-HTTP-Method': 'MERGE'
|
|
83
|
+
},
|
|
84
|
+
data: requestBody,
|
|
85
|
+
responseType: 'json'
|
|
86
|
+
};
|
|
87
|
+
return yield request_1.default.post(requestOptions);
|
|
88
|
+
});
|
|
87
89
|
}
|
|
88
90
|
/**
|
|
89
91
|
* Merge request with `web` scope is send first.
|
|
@@ -91,25 +93,15 @@ class SpoCustomActionSetCommand extends SpoCommand_1.default {
|
|
|
91
93
|
* another merge request is send with `site` scope.
|
|
92
94
|
*/
|
|
93
95
|
searchAllScopes(options) {
|
|
94
|
-
return
|
|
96
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
95
97
|
options.scope = "Web";
|
|
96
|
-
this
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
this
|
|
104
|
-
.updateCustomAction(options)
|
|
105
|
-
.then((siteResult) => {
|
|
106
|
-
return resolve(siteResult);
|
|
107
|
-
}, (err) => {
|
|
108
|
-
reject(err);
|
|
109
|
-
});
|
|
110
|
-
}, (err) => {
|
|
111
|
-
reject(err);
|
|
112
|
-
});
|
|
98
|
+
const webResult = yield this.updateCustomAction(options);
|
|
99
|
+
if (webResult === undefined || webResult["odata.null"] !== true) {
|
|
100
|
+
return webResult;
|
|
101
|
+
}
|
|
102
|
+
options.scope = "Site";
|
|
103
|
+
const siteResult = yield this.updateCustomAction(options);
|
|
104
|
+
return siteResult;
|
|
113
105
|
});
|
|
114
106
|
}
|
|
115
107
|
mapRequestBody(options) {
|