@pnp/cli-microsoft365 6.0.0-beta.42305df → 6.0.0-beta.48a730d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +15 -2
- package/README.md +5 -0
- package/dist/Command.js +16 -2
- package/dist/m365/aad/commands/app/app-add.js +36 -13
- package/dist/m365/aad/commands/app/app-list.js +38 -0
- package/dist/m365/aad/commands/user/user-guest-add.js +103 -0
- package/dist/m365/aad/commands.js +2 -0
- package/dist/m365/commands/status.js +6 -1
- package/dist/m365/outlook/commands/mail/mail-send.js +55 -31
- package/dist/m365/outlook/commands/message/message-get.js +97 -0
- package/dist/m365/outlook/commands.js +1 -0
- package/dist/m365/planner/commands/bucket/bucket-get.js +1 -1
- package/dist/m365/planner/commands/plan/plan-get.js +5 -20
- package/dist/m365/pp/commands/Environment.js +3 -0
- package/dist/m365/pp/commands/card/card-get.js +110 -0
- package/dist/m365/pp/commands/card/card-list.js +68 -0
- package/dist/m365/pp/commands/card/card-remove.js +130 -0
- package/dist/m365/pp/commands/dataverse/dataverse-table-list.js +6 -12
- package/dist/m365/pp/commands/environment/environment-get.js +75 -0
- package/dist/m365/pp/commands/gateway/gateway-get.js +70 -0
- package/dist/m365/pp/commands/solution/Solution.js +3 -0
- package/dist/m365/pp/commands/solution/solution-get.js +117 -0
- package/dist/m365/pp/commands/solution/solution-list.js +87 -0
- package/dist/m365/pp/commands.js +7 -0
- package/dist/m365/spfx/commands/project/project-doctor.js +4 -1
- package/dist/m365/spfx/commands/project/project-externalize.js +4 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010001_YORC_version.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010002_YORC_isCreatingSolution.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010003_YORC_packageManager.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010004_YORC_componentType.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010005_YORC_environment.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010006_YORC_framework.js +3 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010007_YORC_isDomainIsolated.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010008_YORC_nodeVersion.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010009_YORC_sdkVersions_microsoft_graph_client.js +56 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN010010_YORC_sdkVersions_teams_js.js +56 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.14.0.js +0 -2
- package/dist/m365/spfx/commands/project/project-upgrade/{upgrade-1.16.0-beta.1.js → upgrade-1.16.0-beta.2.js} +44 -28
- package/dist/m365/spfx/commands/project/project-upgrade.js +5 -2
- package/dist/m365/spfx/commands/spfx-doctor.js +39 -9
- package/dist/m365/spo/commands/contenttype/contenttype-add.js +82 -43
- package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +53 -21
- package/dist/m365/spo/commands/contenttype/contenttype-get.js +35 -14
- package/dist/m365/spo/commands/eventreceiver/EventReceiver.js +3 -0
- package/dist/m365/spo/commands/eventreceiver/eventreceiver-remove.js +182 -0
- package/dist/m365/spo/commands/field/field-add.js +26 -1
- package/dist/m365/spo/commands/field/field-set.js +23 -13
- package/dist/m365/spo/commands/file/file-copy.js +25 -39
- package/dist/m365/spo/commands/file/file-move.js +24 -37
- package/dist/m365/spo/commands/file/file-rename.js +19 -16
- package/dist/m365/spo/commands/file/file-roleinheritance-break.js +129 -0
- package/dist/m365/spo/commands/folder/folder-list.js +35 -12
- package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +168 -0
- package/dist/m365/spo/commands/folder/folder-roleinheritance-break.js +11 -1
- package/dist/m365/spo/commands/folder/folder-roleinheritance-reset.js +12 -1
- package/dist/m365/spo/commands/group/AssociatedGroupPropertiesCollection.js +3 -0
- package/dist/m365/spo/commands/group/group-list.js +49 -10
- package/dist/m365/spo/commands/list/list-contenttype-add.js +21 -18
- package/dist/m365/spo/commands/list/list-contenttype-default-set.js +59 -47
- package/dist/m365/spo/commands/list/list-contenttype-list.js +16 -8
- package/dist/m365/spo/commands/list/list-contenttype-remove.js +16 -8
- package/dist/m365/spo/commands/list/list-roleassignment-add.js +10 -10
- package/dist/m365/spo/commands/list/list-roleassignment-remove.js +8 -8
- package/dist/m365/spo/commands/list/list-roleinheritance-break.js +14 -6
- package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +14 -6
- package/dist/m365/spo/commands/list/list-webhook-add.js +19 -11
- package/dist/m365/spo/commands/list/list-webhook-get.js +17 -10
- package/dist/m365/spo/commands/list/list-webhook-list.js +17 -42
- package/dist/m365/spo/commands/list/list-webhook-remove.js +19 -11
- package/dist/m365/spo/commands/list/list-webhook-set.js +27 -20
- package/dist/m365/spo/commands/listitem/listitem-add.js +24 -14
- package/dist/m365/spo/commands/listitem/listitem-attachment-list.js +18 -8
- package/dist/m365/spo/commands/listitem/listitem-get.js +18 -8
- package/dist/m365/spo/commands/listitem/listitem-isrecord.js +20 -10
- package/dist/m365/spo/commands/listitem/listitem-list.js +21 -11
- package/dist/m365/spo/commands/listitem/listitem-record-declare.js +19 -12
- package/dist/m365/spo/commands/listitem/listitem-record-undeclare.js +24 -21
- package/dist/m365/spo/commands/listitem/listitem-remove.js +19 -11
- package/dist/m365/spo/commands/listitem/listitem-roleassignment-add.js +239 -0
- package/dist/m365/spo/commands/listitem/listitem-roleassignment-remove.js +8 -8
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +13 -5
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +13 -5
- package/dist/m365/spo/commands/listitem/listitem-set.js +52 -44
- package/dist/m365/spo/commands/roledefinition/roledefinition-list.js +15 -2
- package/dist/m365/spo/commands/site/site-add.js +4 -11
- package/dist/m365/spo/commands/{hubsite/hubsite-connect.js → site/site-hubsite-connect.js} +10 -10
- package/dist/m365/spo/commands/{hubsite/hubsite-disconnect.js → site/site-hubsite-disconnect.js} +13 -13
- package/dist/m365/spo/commands/{hubsite/hubsite-theme-sync.js → site/site-hubsite-theme-sync.js} +11 -11
- package/dist/m365/spo/commands/web/web-roleassignment-add.js +10 -10
- package/dist/m365/spo/commands/web/web-roleassignment-remove.js +8 -8
- package/dist/m365/spo/commands/web/web-roleinheritance-break.js +100 -0
- package/dist/m365/spo/commands.js +8 -3
- package/dist/m365/teams/commands/channel/channel-add.js +9 -9
- package/dist/m365/teams/commands/team/team-set.js +0 -7
- package/dist/m365/todo/commands/list/list-get.js +89 -0
- package/dist/m365/todo/commands/task/task-add.js +55 -3
- package/dist/m365/todo/commands/task/task-get.js +108 -0
- package/dist/m365/todo/commands/task/task-set.js +53 -1
- package/dist/m365/todo/commands.js +2 -0
- package/dist/utils/md.js +8 -1
- package/docs/docs/_clisettings.md +18 -0
- package/docs/docs/cmd/aad/app/app-list.md +149 -0
- package/docs/docs/cmd/aad/user/user-guest-add.md +107 -0
- package/docs/docs/cmd/adaptivecard/adaptivecard-send.md +3 -0
- package/docs/docs/cmd/graph/schemaextension/schemaextension-add.md +4 -11
- package/docs/docs/cmd/graph/schemaextension/schemaextension-set.md +4 -10
- package/docs/docs/cmd/outlook/mail/mail-send.md +13 -0
- package/docs/docs/cmd/outlook/message/message-get.md +48 -0
- package/docs/docs/cmd/planner/bucket/bucket-add.md +29 -0
- package/docs/docs/cmd/planner/bucket/bucket-get.md +29 -0
- package/docs/docs/cmd/planner/bucket/bucket-list.md +30 -0
- package/docs/docs/cmd/planner/bucket/bucket-remove.md +4 -0
- package/docs/docs/cmd/planner/bucket/bucket-set.md +4 -0
- package/docs/docs/cmd/planner/plan/plan-add.md +123 -0
- package/docs/docs/cmd/planner/plan/plan-get.md +75 -6
- package/docs/docs/cmd/planner/plan/plan-list.md +45 -0
- package/docs/docs/cmd/planner/plan/plan-remove.md +4 -0
- package/docs/docs/cmd/planner/task/task-get.md +0 -3
- package/docs/docs/cmd/pp/card/card-get.md +51 -0
- package/docs/docs/cmd/pp/card/card-list.md +33 -0
- package/docs/docs/cmd/pp/card/card-remove.md +82 -0
- package/docs/docs/cmd/pp/dataverse/dataverse-table-list.md +2 -2
- package/docs/docs/cmd/pp/environment/environment-get.md +38 -0
- package/docs/docs/cmd/pp/environment/environment-list.md +1 -1
- package/docs/docs/cmd/pp/gateway/gateway-get.md +24 -0
- package/docs/docs/cmd/pp/solution/solution-get.md +51 -0
- package/docs/docs/cmd/pp/solution/solution-list.md +33 -0
- package/docs/docs/cmd/spfx/project/project-rename.md +1 -14
- package/docs/docs/cmd/spfx/project/project-upgrade.md +1 -1
- package/docs/docs/cmd/spfx/spfx-doctor.md +10 -1
- package/docs/docs/cmd/spo/contenttype/contenttype-add.md +20 -2
- package/docs/docs/cmd/spo/contenttype/contenttype-field-remove.md +22 -4
- package/docs/docs/cmd/spo/contenttype/contenttype-get.md +21 -3
- package/docs/docs/cmd/spo/customaction/customaction-add.md +3 -0
- package/docs/docs/cmd/spo/customaction/customaction-set.md +3 -2
- package/docs/docs/cmd/spo/eventreceiver/eventreceiver-get.md +2 -2
- package/docs/docs/cmd/spo/eventreceiver/eventreceiver-remove.md +69 -0
- package/docs/docs/cmd/spo/field/field-add.md +20 -2
- package/docs/docs/cmd/spo/field/field-set.md +15 -3
- package/docs/docs/cmd/spo/file/file-roleinheritance-break.md +54 -0
- package/docs/docs/cmd/spo/folder/folder-list.md +45 -0
- package/docs/docs/cmd/spo/folder/folder-roleassignment-remove.md +57 -0
- package/docs/docs/cmd/spo/folder/folder-roleinheritance-break.md +6 -0
- package/docs/docs/cmd/spo/folder/folder-roleinheritance-reset.md +6 -0
- package/docs/docs/cmd/spo/group/group-list.md +10 -1
- package/docs/docs/cmd/spo/hubsite/hubsite-register.md +2 -2
- package/docs/docs/cmd/spo/hubsite/hubsite-unregister.md +2 -2
- package/docs/docs/cmd/spo/list/list-contenttype-add.md +15 -6
- package/docs/docs/cmd/spo/list/list-contenttype-default-set.md +16 -7
- package/docs/docs/cmd/spo/list/list-contenttype-list.md +15 -6
- package/docs/docs/cmd/spo/list/list-contenttype-remove.md +16 -7
- package/docs/docs/cmd/spo/list/list-roleinheritance-break.md +11 -8
- package/docs/docs/cmd/spo/list/list-roleinheritance-reset.md +16 -7
- package/docs/docs/cmd/spo/list/list-view-set.md +14 -3
- package/docs/docs/cmd/spo/list/list-webhook-add.md +15 -16
- package/docs/docs/cmd/spo/list/list-webhook-get.md +16 -7
- package/docs/docs/cmd/spo/list/list-webhook-list.md +13 -10
- package/docs/docs/cmd/spo/list/list-webhook-remove.md +12 -10
- package/docs/docs/cmd/spo/list/list-webhook-set.md +21 -12
- package/docs/docs/cmd/spo/listitem/listitem-add.md +11 -2
- package/docs/docs/cmd/spo/listitem/listitem-attachment-list.md +11 -2
- package/docs/docs/cmd/spo/listitem/listitem-get.md +11 -2
- package/docs/docs/cmd/spo/listitem/listitem-isrecord.md +12 -2
- package/docs/docs/cmd/spo/listitem/listitem-list.md +10 -1
- package/docs/docs/cmd/spo/listitem/listitem-record-declare.md +7 -4
- package/docs/docs/cmd/spo/listitem/listitem-record-undeclare.md +11 -2
- package/docs/docs/cmd/spo/listitem/listitem-remove.md +11 -2
- package/docs/docs/cmd/spo/listitem/listitem-roleassignment-add.md +81 -0
- package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-break.md +7 -4
- package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-reset.md +8 -5
- package/docs/docs/cmd/spo/listitem/listitem-set.md +7 -4
- package/docs/docs/cmd/spo/page/page-clientsidewebpart-add.md +5 -10
- package/docs/docs/cmd/spo/page/page-control-set.md +2 -1
- package/docs/docs/cmd/spo/site/site-add.md +0 -3
- package/docs/docs/cmd/spo/{hubsite/hubsite-connect.md → site/site-hubsite-connect.md} +4 -4
- package/docs/docs/cmd/spo/{hubsite/hubsite-disconnect.md → site/site-hubsite-disconnect.md} +7 -7
- package/docs/docs/cmd/spo/{hubsite/hubsite-theme-sync.md → site/site-hubsite-theme-sync.md} +5 -5
- package/docs/docs/cmd/spo/term/term-add.md +5 -0
- package/docs/docs/cmd/spo/term/term-set-add.md +6 -1
- package/docs/docs/cmd/spo/web/web-roleinheritance-break.md +44 -0
- package/docs/docs/cmd/teams/channel/channel-add.md +4 -4
- package/docs/docs/cmd/teams/team/team-clone.md +0 -3
- package/docs/docs/cmd/teams/team/team-set.md +0 -3
- package/docs/docs/cmd/tenant/id/id-get.md +20 -0
- package/docs/docs/cmd/tenant/report/report-activeusercounts.md +35 -0
- package/docs/docs/cmd/tenant/report/report-activeuserdetail.md +49 -0
- package/docs/docs/cmd/tenant/report/report-office365activationcounts.md +32 -0
- package/docs/docs/cmd/tenant/report/report-office365activationsusercounts.md +30 -0
- package/docs/docs/cmd/tenant/report/report-office365activationsuserdetail.md +36 -0
- package/docs/docs/cmd/tenant/report/report-servicesusercounts.md +41 -0
- package/docs/docs/cmd/tenant/security/security-alerts-list.md +105 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-get.md +87 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-health-list.md +91 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-get.md +62 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-healthissue-list.md +51 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-get.md +64 -0
- package/docs/docs/cmd/tenant/serviceannouncement/serviceannouncement-message-list.md +52 -0
- package/docs/docs/cmd/todo/list/list-get.md +61 -0
- package/docs/docs/cmd/todo/task/task-add.md +32 -5
- package/docs/docs/cmd/todo/task/task-get.md +75 -0
- package/docs/docs/cmd/todo/task/task-set.md +29 -2
- package/package.json +13 -3
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN006006_CFG_PS_features.js +0 -60
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
+
};
|
|
16
|
+
var _SpoEventreceiverRemoveCommand_instances, _SpoEventreceiverRemoveCommand_initTelemetry, _SpoEventreceiverRemoveCommand_initOptions, _SpoEventreceiverRemoveCommand_initValidators, _SpoEventreceiverRemoveCommand_initOptionSets;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const Cli_1 = require("../../../../cli/Cli");
|
|
19
|
+
const formatting_1 = require("../../../../utils/formatting");
|
|
20
|
+
const urlUtil_1 = require("../../../../utils/urlUtil");
|
|
21
|
+
const validation_1 = require("../../../../utils/validation");
|
|
22
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
23
|
+
const commands_1 = require("../../commands");
|
|
24
|
+
const request_1 = require("../../../../request");
|
|
25
|
+
const getCommand = require('./eventreceiver-get');
|
|
26
|
+
class SpoEventreceiverRemoveCommand extends SpoCommand_1.default {
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
_SpoEventreceiverRemoveCommand_instances.add(this);
|
|
30
|
+
__classPrivateFieldGet(this, _SpoEventreceiverRemoveCommand_instances, "m", _SpoEventreceiverRemoveCommand_initTelemetry).call(this);
|
|
31
|
+
__classPrivateFieldGet(this, _SpoEventreceiverRemoveCommand_instances, "m", _SpoEventreceiverRemoveCommand_initOptions).call(this);
|
|
32
|
+
__classPrivateFieldGet(this, _SpoEventreceiverRemoveCommand_instances, "m", _SpoEventreceiverRemoveCommand_initValidators).call(this);
|
|
33
|
+
__classPrivateFieldGet(this, _SpoEventreceiverRemoveCommand_instances, "m", _SpoEventreceiverRemoveCommand_initOptionSets).call(this);
|
|
34
|
+
}
|
|
35
|
+
get name() {
|
|
36
|
+
return commands_1.default.EVENTRECEIVER_REMOVE;
|
|
37
|
+
}
|
|
38
|
+
get description() {
|
|
39
|
+
return 'Removes event receivers for the specified web, site, or list.';
|
|
40
|
+
}
|
|
41
|
+
commandAction(logger, args) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
try {
|
|
44
|
+
const getEventReceiversOutput = yield this.getEventReceivers(args.options);
|
|
45
|
+
const eventReceivers = JSON.parse(getEventReceiversOutput.stdout);
|
|
46
|
+
if (!eventReceivers.length) {
|
|
47
|
+
throw Error(`Specified event receiver with ${args.options.id !== undefined ? `id ${args.options.id}` : `name ${args.options.name}`} cannot be found`);
|
|
48
|
+
}
|
|
49
|
+
if (eventReceivers.length > 1) {
|
|
50
|
+
throw Error(`Multiple eventreceivers with ${args.options.id !== undefined ? `id ${args.options.id} found` : `name ${args.options.name}, ids: ${eventReceivers.map(x => x.ReceiverId)} found`}`);
|
|
51
|
+
}
|
|
52
|
+
if (args.options.confirm) {
|
|
53
|
+
yield this.removeEventReceiver(args.options);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
const result = yield Cli_1.Cli.prompt({
|
|
57
|
+
type: 'confirm',
|
|
58
|
+
name: 'continue',
|
|
59
|
+
default: false,
|
|
60
|
+
message: `Are you sure you want to remove event receiver with ${args.options.id !== undefined ? `id ${args.options.id}` : `name ${args.options.name}`}?`
|
|
61
|
+
});
|
|
62
|
+
if (result.continue) {
|
|
63
|
+
yield this.removeEventReceiver(args.options);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
this.handleRejectedODataJsonPromise(err);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
removeEventReceiver(options) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
let requestUrl = `${options.webUrl}/_api/`;
|
|
75
|
+
let listUrl = '';
|
|
76
|
+
let filter = '?$filter=';
|
|
77
|
+
if (options.listId) {
|
|
78
|
+
listUrl = `lists(guid'${formatting_1.formatting.encodeQueryParameter(options.listId)}')/`;
|
|
79
|
+
}
|
|
80
|
+
else if (options.listTitle) {
|
|
81
|
+
listUrl = `lists/getByTitle('${formatting_1.formatting.encodeQueryParameter(options.listTitle)}')/`;
|
|
82
|
+
}
|
|
83
|
+
else if (options.listUrl) {
|
|
84
|
+
const listServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(options.webUrl, options.listUrl);
|
|
85
|
+
listUrl = `GetList('${formatting_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')/`;
|
|
86
|
+
}
|
|
87
|
+
if (!options.scope || options.scope === 'web') {
|
|
88
|
+
requestUrl += `web/${listUrl}eventreceivers`;
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
requestUrl += 'site/eventreceivers';
|
|
92
|
+
}
|
|
93
|
+
if (options.id) {
|
|
94
|
+
filter += `receiverid eq (guid'${options.id}')`;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
filter += `receivername eq '${options.name}'`;
|
|
98
|
+
}
|
|
99
|
+
const requestOptions = {
|
|
100
|
+
url: requestUrl + filter,
|
|
101
|
+
headers: {
|
|
102
|
+
'accept': 'application/json;odata=nometadata'
|
|
103
|
+
},
|
|
104
|
+
responseType: 'json'
|
|
105
|
+
};
|
|
106
|
+
yield request_1.default.delete(requestOptions);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
getEventReceivers(options) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
const getOptions = {
|
|
112
|
+
webUrl: options.webUrl,
|
|
113
|
+
listId: options.listId,
|
|
114
|
+
listTitle: options.listTitle,
|
|
115
|
+
listUrl: options.listUrl,
|
|
116
|
+
scope: options.scope,
|
|
117
|
+
id: options.id,
|
|
118
|
+
name: options.name,
|
|
119
|
+
debug: this.debug,
|
|
120
|
+
verbose: this.verbose
|
|
121
|
+
};
|
|
122
|
+
return yield Cli_1.Cli.executeCommandWithOutput(getCommand, { options: Object.assign(Object.assign({}, getOptions), { _: [] }) });
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
_SpoEventreceiverRemoveCommand_instances = new WeakSet(), _SpoEventreceiverRemoveCommand_initTelemetry = function _SpoEventreceiverRemoveCommand_initTelemetry() {
|
|
127
|
+
this.telemetry.push((args) => {
|
|
128
|
+
Object.assign(this.telemetryProperties, {
|
|
129
|
+
listId: typeof args.options.listId !== 'undefined',
|
|
130
|
+
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
131
|
+
listUrl: typeof args.options.listUrl !== 'undefined',
|
|
132
|
+
scope: typeof args.options.scope !== 'undefined',
|
|
133
|
+
id: typeof args.options.id !== 'undefined',
|
|
134
|
+
name: typeof args.options.name !== 'undefined',
|
|
135
|
+
confirm: (!(!args.options.confirm)).toString()
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
}, _SpoEventreceiverRemoveCommand_initOptions = function _SpoEventreceiverRemoveCommand_initOptions() {
|
|
139
|
+
this.options.unshift({
|
|
140
|
+
option: '-u, --webUrl <webUrl>'
|
|
141
|
+
}, {
|
|
142
|
+
option: '--listTitle [listTitle]'
|
|
143
|
+
}, {
|
|
144
|
+
option: '--listId [listId]'
|
|
145
|
+
}, {
|
|
146
|
+
option: '--listUrl [listUrl]'
|
|
147
|
+
}, {
|
|
148
|
+
option: '-n, --name [name]'
|
|
149
|
+
}, {
|
|
150
|
+
option: '-i, --id [id]'
|
|
151
|
+
}, {
|
|
152
|
+
option: '-s, --scope [scope]',
|
|
153
|
+
autocomplete: ['web', 'site']
|
|
154
|
+
}, {
|
|
155
|
+
option: '--confirm'
|
|
156
|
+
});
|
|
157
|
+
}, _SpoEventreceiverRemoveCommand_initValidators = function _SpoEventreceiverRemoveCommand_initValidators() {
|
|
158
|
+
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
|
|
159
|
+
const isValidSharePointUrl = validation_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
160
|
+
if (isValidSharePointUrl !== true) {
|
|
161
|
+
return isValidSharePointUrl;
|
|
162
|
+
}
|
|
163
|
+
const listOptions = [args.options.listId, args.options.listTitle, args.options.listUrl];
|
|
164
|
+
if (listOptions.some(item => item !== undefined) && listOptions.filter(item => item !== undefined).length > 1) {
|
|
165
|
+
return `Specify either list id or title or list url`;
|
|
166
|
+
}
|
|
167
|
+
if (args.options.listId && !validation_1.validation.isValidGuid(args.options.listId)) {
|
|
168
|
+
return `${args.options.listId} is not a valid GUID`;
|
|
169
|
+
}
|
|
170
|
+
if (args.options.scope && ['web', 'site'].indexOf(args.options.scope) === -1) {
|
|
171
|
+
return `${args.options.scope} is not a valid type value. Allowed values web|site.`;
|
|
172
|
+
}
|
|
173
|
+
if (args.options.scope && args.options.scope === 'site' && (args.options.listId || args.options.listUrl || args.options.listTitle)) {
|
|
174
|
+
return 'Scope cannot be set to site when retrieving list event receivers.';
|
|
175
|
+
}
|
|
176
|
+
return true;
|
|
177
|
+
}));
|
|
178
|
+
}, _SpoEventreceiverRemoveCommand_initOptionSets = function _SpoEventreceiverRemoveCommand_initOptionSets() {
|
|
179
|
+
this.optionSets.push(['name', 'id']);
|
|
180
|
+
};
|
|
181
|
+
module.exports = new SpoEventreceiverRemoveCommand();
|
|
182
|
+
//# sourceMappingURL=eventreceiver-remove.js.map
|
|
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
const request_1 = require("../../../../request");
|
|
19
19
|
const formatting_1 = require("../../../../utils/formatting");
|
|
20
20
|
const spo_1 = require("../../../../utils/spo");
|
|
21
|
+
const urlUtil_1 = require("../../../../utils/urlUtil");
|
|
21
22
|
const validation_1 = require("../../../../utils/validation");
|
|
22
23
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
23
24
|
const commands_1 = require("../../commands");
|
|
@@ -38,9 +39,20 @@ class SpoFieldAddCommand extends SpoCommand_1.default {
|
|
|
38
39
|
commandAction(logger, args) {
|
|
39
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
41
|
try {
|
|
42
|
+
let requestUrl = `${args.options.webUrl}/_api/web`;
|
|
43
|
+
if (args.options.listId) {
|
|
44
|
+
requestUrl += `/lists(guid'${formatting_1.formatting.encodeQueryParameter(args.options.listId)}')`;
|
|
45
|
+
}
|
|
46
|
+
else if (args.options.listTitle) {
|
|
47
|
+
requestUrl += `/lists/getByTitle('${formatting_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
|
|
48
|
+
}
|
|
49
|
+
else if (args.options.listUrl) {
|
|
50
|
+
const listServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
51
|
+
requestUrl += `/GetList('${formatting_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
|
|
52
|
+
}
|
|
41
53
|
const reqDigest = yield spo_1.spo.getRequestDigest(args.options.webUrl);
|
|
42
54
|
const requestOptions = {
|
|
43
|
-
url: `${
|
|
55
|
+
url: `${requestUrl}/fields/CreateFieldAsXml`,
|
|
44
56
|
headers: {
|
|
45
57
|
'X-RequestDigest': reqDigest.FormDigestValue,
|
|
46
58
|
accept: 'application/json;odata=nometadata'
|
|
@@ -99,6 +111,8 @@ _SpoFieldAddCommand_instances = new WeakSet(), _SpoFieldAddCommand_initTelemetry
|
|
|
99
111
|
this.telemetry.push((args) => {
|
|
100
112
|
Object.assign(this.telemetryProperties, {
|
|
101
113
|
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
114
|
+
listId: typeof args.options.listId !== 'undefined',
|
|
115
|
+
listUrl: typeof args.options.listUrl !== 'undefined',
|
|
102
116
|
options: typeof args.options.options !== 'undefined'
|
|
103
117
|
});
|
|
104
118
|
});
|
|
@@ -107,6 +121,10 @@ _SpoFieldAddCommand_instances = new WeakSet(), _SpoFieldAddCommand_initTelemetry
|
|
|
107
121
|
option: '-u, --webUrl <webUrl>'
|
|
108
122
|
}, {
|
|
109
123
|
option: '-l, --listTitle [listTitle]'
|
|
124
|
+
}, {
|
|
125
|
+
option: '--listId [listId]'
|
|
126
|
+
}, {
|
|
127
|
+
option: '--listUrl [listUrl]'
|
|
110
128
|
}, {
|
|
111
129
|
option: '-x, --xml <xml>'
|
|
112
130
|
}, {
|
|
@@ -118,6 +136,13 @@ _SpoFieldAddCommand_instances = new WeakSet(), _SpoFieldAddCommand_initTelemetry
|
|
|
118
136
|
if (isValidSharePointUrl !== true) {
|
|
119
137
|
return isValidSharePointUrl;
|
|
120
138
|
}
|
|
139
|
+
const listOptions = [args.options.listId, args.options.listTitle, args.options.listUrl];
|
|
140
|
+
if (listOptions.some(item => item !== undefined) && listOptions.filter(item => item !== undefined).length > 1) {
|
|
141
|
+
return `Specify either list id or title or list url, but not multiple`;
|
|
142
|
+
}
|
|
143
|
+
if (args.options.listId && !validation_1.validation.isValidGuid(args.options.listId)) {
|
|
144
|
+
return `${args.options.listId} in option listId is not a valid GUID`;
|
|
145
|
+
}
|
|
121
146
|
if (args.options.options) {
|
|
122
147
|
let optionsError = true;
|
|
123
148
|
const options = ['DefaultValue', 'AddToDefaultContentType', 'AddToNoContentType', 'AddToAllContentTypes', 'AddFieldInternalNameHint', 'AddFieldToDefaultView', 'AddFieldCheckDisplayName'];
|
|
@@ -19,6 +19,7 @@ const config_1 = require("../../../../config");
|
|
|
19
19
|
const request_1 = require("../../../../request");
|
|
20
20
|
const formatting_1 = require("../../../../utils/formatting");
|
|
21
21
|
const spo_1 = require("../../../../utils/spo");
|
|
22
|
+
const urlUtil_1 = require("../../../../utils/urlUtil");
|
|
22
23
|
const validation_1 = require("../../../../utils/validation");
|
|
23
24
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
24
25
|
const commands_1 = require("../../commands");
|
|
@@ -45,23 +46,27 @@ class SpoFieldSetCommand extends SpoCommand_1.default {
|
|
|
45
46
|
try {
|
|
46
47
|
const reqDigest = yield spo_1.spo.getRequestDigest(args.options.webUrl);
|
|
47
48
|
const requestDigest = reqDigest.FormDigestValue;
|
|
48
|
-
let
|
|
49
|
-
if (args.options.listId || args.options.listTitle) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
`<Method Id="663" ParentId="7" Name="
|
|
49
|
+
let fieldsParentIdentity = '<Property Id="5" ParentId="3" Name="Web" /><StaticProperty Id="3" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" />';
|
|
50
|
+
if (args.options.listId || args.options.listTitle || args.options.listUrl) {
|
|
51
|
+
let requestData = '';
|
|
52
|
+
if (args.options.listId) {
|
|
53
|
+
requestData = `<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="664" ObjectPathId="663" /><Query Id="665" ObjectPathId="663"><Query SelectAllProperties="false"><Properties /></Query></Query></Actions><ObjectPaths><Method Id="663" ParentId="7" Name="GetById"><Parameters><Parameter Type="Guid">${formatting_1.formatting.escapeXml(args.options.listId)}</Parameter></Parameters></Method><Property Id="7" ParentId="5" Name="Lists" /><Property Id="5" ParentId="3" Name="Web" /><StaticProperty Id="3" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" /></ObjectPaths></Request>`;
|
|
54
|
+
}
|
|
55
|
+
else if (args.options.listTitle) {
|
|
56
|
+
requestData = `<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="664" ObjectPathId="663" /><Query Id="665" ObjectPathId="663"><Query SelectAllProperties="false"><Properties /></Query></Query></Actions><ObjectPaths><Method Id="663" ParentId="7" Name="GetByTitle"><Parameters><Parameter Type="String">${formatting_1.formatting.escapeXml(args.options.listTitle)}</Parameter></Parameters></Method><Property Id="7" ParentId="5" Name="Lists" /><Property Id="5" ParentId="3" Name="Web" /><StaticProperty Id="3" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" /></ObjectPaths></Request>`;
|
|
57
|
+
}
|
|
58
|
+
else if (args.options.listUrl) {
|
|
59
|
+
const listServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
|
|
60
|
+
requestData = `<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="2" ObjectPathId="1" /><ObjectPath Id="4" ObjectPathId="3" /><ObjectPath Id="6" ObjectPathId="5" /><Query Id="7" ObjectPathId="5"><Query SelectAllProperties="true"><Properties /></Query></Query></Actions><ObjectPaths><StaticProperty Id="1" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" /><Property Id="3" ParentId="1" Name="Web" /><Method Id="5" ParentId="3" Name="GetList"><Parameters><Parameter Type="String">${listServerRelativeUrl}</Parameter></Parameters></Method></ObjectPaths></Request>`;
|
|
61
|
+
}
|
|
53
62
|
const requestOptions = {
|
|
54
63
|
url: `${args.options.webUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
55
64
|
headers: {
|
|
56
65
|
'X-RequestDigest': requestDigest
|
|
57
66
|
},
|
|
58
|
-
data:
|
|
67
|
+
data: requestData
|
|
59
68
|
};
|
|
60
|
-
list = yield request_1.default.post(requestOptions);
|
|
61
|
-
}
|
|
62
|
-
// by default retrieve the column from the site
|
|
63
|
-
let fieldsParentIdentity = '<Property Id="5" ParentId="3" Name="Web" /><StaticProperty Id="3" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" />';
|
|
64
|
-
if (list) {
|
|
69
|
+
const list = yield request_1.default.post(requestOptions);
|
|
65
70
|
const json = JSON.parse(list);
|
|
66
71
|
const response = json[0];
|
|
67
72
|
if (response.ErrorInfo) {
|
|
@@ -113,6 +118,7 @@ class SpoFieldSetCommand extends SpoCommand_1.default {
|
|
|
113
118
|
'webUrl',
|
|
114
119
|
'listId',
|
|
115
120
|
'listTitle',
|
|
121
|
+
'listUrl',
|
|
116
122
|
'id',
|
|
117
123
|
'title',
|
|
118
124
|
'updateExistingLists',
|
|
@@ -134,6 +140,7 @@ _SpoFieldSetCommand_instances = new WeakSet(), _SpoFieldSetCommand_initTelemetry
|
|
|
134
140
|
title: typeof args.options.title !== 'undefined',
|
|
135
141
|
listId: typeof args.options.listId !== 'undefined',
|
|
136
142
|
listTitle: typeof args.options.listTitle !== 'undefined',
|
|
143
|
+
listUrl: typeof args.options.listUrl !== 'undefined',
|
|
137
144
|
updateExistingLists: !!args.options.updateExistingLists
|
|
138
145
|
});
|
|
139
146
|
});
|
|
@@ -144,6 +151,8 @@ _SpoFieldSetCommand_instances = new WeakSet(), _SpoFieldSetCommand_initTelemetry
|
|
|
144
151
|
option: '--listId [listId]'
|
|
145
152
|
}, {
|
|
146
153
|
option: '--listTitle [listTitle]'
|
|
154
|
+
}, {
|
|
155
|
+
option: '--listUrl [listUrl]'
|
|
147
156
|
}, {
|
|
148
157
|
option: '-i, --id [id]'
|
|
149
158
|
}, {
|
|
@@ -157,8 +166,9 @@ _SpoFieldSetCommand_instances = new WeakSet(), _SpoFieldSetCommand_initTelemetry
|
|
|
157
166
|
if (isValidSharePointUrl !== true) {
|
|
158
167
|
return isValidSharePointUrl;
|
|
159
168
|
}
|
|
160
|
-
|
|
161
|
-
|
|
169
|
+
const listOptions = [args.options.listId, args.options.listTitle, args.options.listUrl];
|
|
170
|
+
if (listOptions.some(item => item !== undefined) && listOptions.filter(item => item !== undefined).length > 1) {
|
|
171
|
+
return `Specify either list id or title or list url, but not multiple`;
|
|
162
172
|
}
|
|
163
173
|
if (args.options.listId &&
|
|
164
174
|
!validation_1.validation.isValidGuid(args.options.listId)) {
|
|
@@ -16,12 +16,14 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
16
16
|
var _SpoFileCopyCommand_instances, _SpoFileCopyCommand_initTelemetry, _SpoFileCopyCommand_initOptions, _SpoFileCopyCommand_initValidators;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
const url = require("url");
|
|
19
|
+
const Cli_1 = require("../../../../cli/Cli");
|
|
19
20
|
const request_1 = require("../../../../request");
|
|
20
21
|
const spo_1 = require("../../../../utils/spo");
|
|
21
22
|
const urlUtil_1 = require("../../../../utils/urlUtil");
|
|
22
23
|
const validation_1 = require("../../../../utils/validation");
|
|
23
24
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
24
25
|
const commands_1 = require("../../commands");
|
|
26
|
+
const removeCommand = require('./file-remove');
|
|
25
27
|
class SpoFileCopyCommand extends SpoCommand_1.default {
|
|
26
28
|
constructor() {
|
|
27
29
|
super();
|
|
@@ -123,50 +125,34 @@ class SpoFileCopyCommand extends SpoCommand_1.default {
|
|
|
123
125
|
* Moves file in the site recycle bin
|
|
124
126
|
*/
|
|
125
127
|
recycleFile(tenantUrl, targetUrl, filename, logger) {
|
|
126
|
-
return
|
|
128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
127
129
|
const targetFolderAbsoluteUrl = urlUtil_1.urlUtil.urlCombine(tenantUrl, targetUrl);
|
|
128
|
-
// since the target WebFullUrl is unknown we can use
|
|
130
|
+
// since the target WebFullUrl is unknown we can use getRequestDigest
|
|
129
131
|
// to get it from target folder absolute url.
|
|
130
132
|
// Similar approach used here Microsoft.SharePoint.Client.Web.WebUrlFromFolderUrlDirect
|
|
131
|
-
spo_1.spo
|
|
132
|
-
|
|
133
|
-
.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
133
|
+
const contextResponse = yield spo_1.spo.getRequestDigest(targetFolderAbsoluteUrl);
|
|
134
|
+
if (this.debug) {
|
|
135
|
+
logger.logToStderr(`contextResponse.WebFullUrl: ${contextResponse.WebFullUrl}`);
|
|
136
|
+
}
|
|
137
|
+
const targetFileServerRelativeUrl = `${urlUtil_1.urlUtil.getServerRelativePath(contextResponse.WebFullUrl, targetUrl)}/${filename}`;
|
|
138
|
+
const removeOptions = {
|
|
139
|
+
webUrl: contextResponse.WebFullUrl,
|
|
140
|
+
url: targetFileServerRelativeUrl,
|
|
141
|
+
recycle: true,
|
|
142
|
+
confirm: true,
|
|
143
|
+
debug: this.debug,
|
|
144
|
+
verbose: this.verbose
|
|
145
|
+
};
|
|
146
|
+
try {
|
|
147
|
+
yield Cli_1.Cli.executeCommand(removeCommand, { options: Object.assign(Object.assign({}, removeOptions), { _: [] }) });
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
if (err.error !== undefined && err.error.message !== undefined && err.error.message.includes('does not exist')) {
|
|
139
151
|
}
|
|
140
|
-
|
|
141
|
-
|
|
152
|
+
else {
|
|
153
|
+
throw err;
|
|
142
154
|
}
|
|
143
|
-
|
|
144
|
-
const requestOptions = {
|
|
145
|
-
url: requestUrl,
|
|
146
|
-
method: 'POST',
|
|
147
|
-
headers: {
|
|
148
|
-
'X-HTTP-Method': 'DELETE',
|
|
149
|
-
'If-Match': '*',
|
|
150
|
-
'accept': 'application/json;odata=nometadata'
|
|
151
|
-
},
|
|
152
|
-
responseType: 'json'
|
|
153
|
-
};
|
|
154
|
-
request_1.default.post(requestOptions)
|
|
155
|
-
.then(() => {
|
|
156
|
-
resolve();
|
|
157
|
-
})
|
|
158
|
-
.catch((err) => {
|
|
159
|
-
if (err.statusCode === 404) {
|
|
160
|
-
// file does not exist so can proceed
|
|
161
|
-
return resolve();
|
|
162
|
-
}
|
|
163
|
-
if (this.debug) {
|
|
164
|
-
logger.logToStderr(`recycleFile error...`);
|
|
165
|
-
logger.logToStderr(err);
|
|
166
|
-
}
|
|
167
|
-
reject(err);
|
|
168
|
-
});
|
|
169
|
-
}, (e) => reject(e));
|
|
155
|
+
}
|
|
170
156
|
});
|
|
171
157
|
}
|
|
172
158
|
}
|
|
@@ -16,12 +16,14 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
16
16
|
var _SpoFileMoveCommand_instances, _SpoFileMoveCommand_initTelemetry, _SpoFileMoveCommand_initOptions, _SpoFileMoveCommand_initValidators;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
const url = require("url");
|
|
19
|
+
const Cli_1 = require("../../../../cli/Cli");
|
|
19
20
|
const request_1 = require("../../../../request");
|
|
20
21
|
const spo_1 = require("../../../../utils/spo");
|
|
21
22
|
const urlUtil_1 = require("../../../../utils/urlUtil");
|
|
22
23
|
const validation_1 = require("../../../../utils/validation");
|
|
23
24
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
24
25
|
const commands_1 = require("../../commands");
|
|
26
|
+
const removeCommand = require('./file-remove');
|
|
25
27
|
class SpoFileMoveCommand extends SpoCommand_1.default {
|
|
26
28
|
constructor() {
|
|
27
29
|
super();
|
|
@@ -124,49 +126,34 @@ class SpoFileMoveCommand extends SpoCommand_1.default {
|
|
|
124
126
|
* Moves file in the site recycle bin
|
|
125
127
|
*/
|
|
126
128
|
recycleFile(tenantUrl, targetUrl, filename, logger) {
|
|
127
|
-
return
|
|
129
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
128
130
|
const targetFolderAbsoluteUrl = urlUtil_1.urlUtil.urlCombine(tenantUrl, targetUrl);
|
|
129
131
|
// since the target WebFullUrl is unknown we can use getRequestDigest
|
|
130
132
|
// to get it from target folder absolute url.
|
|
131
133
|
// Similar approach used here Microsoft.SharePoint.Client.Web.WebUrlFromFolderUrlDirect
|
|
132
|
-
spo_1.spo.getRequestDigest(targetFolderAbsoluteUrl)
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
134
|
+
const contextResponse = yield spo_1.spo.getRequestDigest(targetFolderAbsoluteUrl);
|
|
135
|
+
if (this.debug) {
|
|
136
|
+
logger.logToStderr(`contextResponse.WebFullUrl: ${contextResponse.WebFullUrl}`);
|
|
137
|
+
}
|
|
138
|
+
const targetFileServerRelativeUrl = `${urlUtil_1.urlUtil.getServerRelativePath(contextResponse.WebFullUrl, targetUrl)}/${filename}`;
|
|
139
|
+
const removeOptions = {
|
|
140
|
+
webUrl: contextResponse.WebFullUrl,
|
|
141
|
+
url: targetFileServerRelativeUrl,
|
|
142
|
+
recycle: true,
|
|
143
|
+
confirm: true,
|
|
144
|
+
debug: this.debug,
|
|
145
|
+
verbose: this.verbose
|
|
146
|
+
};
|
|
147
|
+
try {
|
|
148
|
+
yield Cli_1.Cli.executeCommand(removeCommand, { options: Object.assign(Object.assign({}, removeOptions), { _: [] }) });
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
if (err.error !== undefined && err.error.message !== undefined && err.error.message.includes('does not exist')) {
|
|
139
152
|
}
|
|
140
|
-
|
|
141
|
-
|
|
153
|
+
else {
|
|
154
|
+
throw err;
|
|
142
155
|
}
|
|
143
|
-
|
|
144
|
-
const requestOptions = {
|
|
145
|
-
url: requestUrl,
|
|
146
|
-
method: 'POST',
|
|
147
|
-
headers: {
|
|
148
|
-
'X-HTTP-Method': 'DELETE',
|
|
149
|
-
'If-Match': '*',
|
|
150
|
-
'accept': 'application/json;odata=nometadata'
|
|
151
|
-
},
|
|
152
|
-
responseType: 'json'
|
|
153
|
-
};
|
|
154
|
-
request_1.default.post(requestOptions)
|
|
155
|
-
.then(() => {
|
|
156
|
-
resolve();
|
|
157
|
-
})
|
|
158
|
-
.catch((err) => {
|
|
159
|
-
if (err.statusCode === 404) {
|
|
160
|
-
// file does not exist so can proceed
|
|
161
|
-
return resolve();
|
|
162
|
-
}
|
|
163
|
-
if (this.debug) {
|
|
164
|
-
logger.logToStderr(`recycleFile error...`);
|
|
165
|
-
logger.logToStderr(err);
|
|
166
|
-
}
|
|
167
|
-
reject(err);
|
|
168
|
-
});
|
|
169
|
-
}, (e) => reject(e));
|
|
156
|
+
}
|
|
170
157
|
});
|
|
171
158
|
}
|
|
172
159
|
}
|
|
@@ -79,23 +79,26 @@ class SpoFileRenameCommand extends SpoCommand_1.default {
|
|
|
79
79
|
return request_1.default.get(requestOptions);
|
|
80
80
|
}
|
|
81
81
|
deleteFile(webUrl, sourceUrl, targetFileName) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
82
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
const targetFileServerRelativeUrl = `${urlUtil_1.urlUtil.getServerRelativePath(webUrl, sourceUrl.substring(0, sourceUrl.lastIndexOf('/')))}/${targetFileName}`;
|
|
84
|
+
const removeOptions = {
|
|
85
|
+
webUrl: webUrl,
|
|
86
|
+
url: targetFileServerRelativeUrl,
|
|
87
|
+
recycle: true,
|
|
88
|
+
confirm: true,
|
|
89
|
+
debug: this.debug,
|
|
90
|
+
verbose: this.verbose
|
|
91
|
+
};
|
|
92
|
+
try {
|
|
93
|
+
yield Cli_1.Cli.executeCommand(removeCommand, { options: Object.assign(Object.assign({}, removeOptions), { _: [] }) });
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
if (err.error !== undefined && err.error.message !== undefined && err.error.message.includes('does not exist')) {
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
throw err;
|
|
100
|
+
}
|
|
97
101
|
}
|
|
98
|
-
return Promise.reject(err);
|
|
99
102
|
});
|
|
100
103
|
}
|
|
101
104
|
}
|