@pnp/cli-microsoft365 10.9.0-beta.bc13e90 → 10.10.0-beta.3dc1bcf
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 +1 -1
- package/.devproxy/api-specs/sharepoint-admin.yaml +67 -0
- package/.devproxy/api-specs/sharepoint.yaml +230 -0
- package/.devproxy/devproxyrc.json +48 -0
- package/.devproxy/generate-openapi-spec.json +24 -0
- package/.devproxy/spo-csom-types.json +54 -0
- package/.eslintrc.cjs +8 -0
- package/Dockerfile +3 -3
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/cli/cli.js +1 -1
- package/dist/m365/entra/commands/m365group/m365group-get.js +16 -3
- package/dist/m365/entra/commands/m365group/m365group-list.js +7 -1
- package/dist/m365/entra/commands/pim/pim-role-assignment-eligibility-list.js +9 -3
- package/dist/m365/entra/commands/pim/pim-role-assignment-list.js +9 -3
- package/dist/m365/entra/commands/pim/pim-role-request-list.js +9 -3
- package/dist/m365/file/commands/file-copy.js +2 -2
- package/dist/m365/file/commands/file-move.js +1 -1
- package/dist/m365/flow/commands/flow-list.js +14 -7
- package/dist/m365/flow/commands/run/run-get.js +1 -1
- package/dist/m365/graph/commands/subscription/subscription-add.js +10 -3
- package/dist/m365/planner/commands/tenant/tenant-settings-list.js +0 -3
- package/dist/m365/pp/commands/solution/solution-publisher-list.js +8 -1
- package/dist/m365/purview/commands/threatassessment/threatassessment-get.js +9 -2
- package/dist/m365/spo/commands/contenttype/contenttype-add.js +3 -65
- package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +5 -50
- package/dist/m365/spo/commands/contenttype/contenttype-field-set.js +4 -48
- package/dist/m365/spo/commands/contenttype/contenttype-set.js +8 -58
- package/dist/m365/spo/commands/contenttype/contenttype-sync.js +2 -2
- package/dist/m365/spo/commands/file/file-move.js +8 -2
- package/dist/m365/spo/commands/folder/folder-sharinglink-add.js +1 -1
- package/dist/m365/spo/commands/folder/folder-sharinglink-clear.js +1 -1
- package/dist/m365/spo/commands/folder/folder-sharinglink-get.js +1 -1
- package/dist/m365/spo/commands/folder/folder-sharinglink-list.js +1 -1
- package/dist/m365/spo/commands/folder/folder-sharinglink-remove.js +1 -1
- package/dist/m365/spo/commands/folder/folder-sharinglink-set.js +1 -1
- package/dist/m365/spo/commands/hubsite/hubsite-get.js +14 -5
- package/dist/m365/spo/commands/hubsite/hubsite-list.js +9 -2
- package/dist/m365/spo/commands/listitem/listitem-batch-set.js +3 -27
- package/dist/m365/spo/commands/page/Page.js +16 -1
- package/dist/m365/spo/commands/page/clientsidepages.js +49 -17
- package/dist/m365/spo/commands/page/page-add.js +1 -1
- package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +2 -8
- package/dist/m365/spo/commands/page/page-control-remove.js +99 -0
- package/dist/m365/spo/commands/page/page-control-set.js +1 -1
- package/dist/m365/spo/commands/page/page-header-set.js +9 -40
- package/dist/m365/spo/commands/page/page-publish.js +2 -10
- package/dist/m365/spo/commands/page/page-section-add.js +2 -8
- package/dist/m365/spo/commands/page/page-set.js +1 -1
- package/dist/m365/spo/commands/site/site-admin-add.js +1 -12
- package/dist/m365/spo/commands/tenant/tenant-site-list.js +16 -5
- package/dist/m365/spo/commands/term/term-list.js +10 -3
- package/dist/m365/spo/commands.js +1 -0
- package/dist/m365/teams/commands/chat/chat-member-add.js +10 -4
- package/dist/m365/viva/commands/engage/engage-community-remove.js +99 -0
- package/dist/m365/viva/commands/engage/engage-network-list.js +8 -2
- package/dist/m365/viva/commands.js +1 -0
- package/dist/utils/md.js +3 -3
- package/dist/utils/spo.js +87 -3
- package/docs/docs/cmd/_global.mdx +1 -1
- package/docs/docs/cmd/entra/m365group/m365group-get.mdx +8 -5
- package/docs/docs/cmd/entra/m365group/m365group-list.mdx +14 -12
- package/docs/docs/cmd/entra/pim/pim-role-assignment-eligibility-list.mdx +7 -4
- package/docs/docs/cmd/entra/pim/pim-role-assignment-list.mdx +9 -6
- package/docs/docs/cmd/entra/pim/pim-role-request-list.mdx +7 -4
- package/docs/docs/cmd/flow/flow-list.mdx +8 -5
- package/docs/docs/cmd/flow/run/run-get.mdx +1 -1
- package/docs/docs/cmd/graph/subscription/subscription-add.mdx +6 -3
- package/docs/docs/cmd/planner/bucket/bucket-add.mdx +19 -0
- package/docs/docs/cmd/planner/bucket/bucket-get.mdx +19 -0
- package/docs/docs/cmd/planner/bucket/bucket-list.mdx +19 -0
- package/docs/docs/cmd/planner/bucket/bucket-remove.mdx +21 -0
- package/docs/docs/cmd/planner/bucket/bucket-set.mdx +21 -0
- package/docs/docs/cmd/planner/plan/plan-add.mdx +19 -0
- package/docs/docs/cmd/planner/plan/plan-get.mdx +19 -0
- package/docs/docs/cmd/planner/plan/plan-list.mdx +19 -0
- package/docs/docs/cmd/planner/plan/plan-remove.mdx +21 -0
- package/docs/docs/cmd/planner/plan/plan-set.mdx +19 -0
- package/docs/docs/cmd/planner/roster/roster-add.mdx +19 -0
- package/docs/docs/cmd/planner/roster/roster-get.mdx +19 -0
- package/docs/docs/cmd/planner/roster/roster-member-add.mdx +19 -0
- package/docs/docs/cmd/planner/roster/roster-member-get.mdx +19 -0
- package/docs/docs/cmd/planner/roster/roster-member-list.mdx +19 -0
- package/docs/docs/cmd/planner/roster/roster-member-remove.mdx +21 -0
- package/docs/docs/cmd/planner/roster/roster-plan-list.mdx +19 -0
- package/docs/docs/cmd/planner/roster/roster-remove.mdx +21 -0
- package/docs/docs/cmd/planner/task/task-add.mdx +19 -0
- package/docs/docs/cmd/planner/task/task-checklistitem-add.mdx +19 -0
- package/docs/docs/cmd/planner/task/task-checklistitem-list.mdx +19 -0
- package/docs/docs/cmd/planner/task/task-checklistitem-remove.mdx +21 -0
- package/docs/docs/cmd/planner/task/task-get.mdx +27 -0
- package/docs/docs/cmd/planner/task/task-list.mdx +19 -0
- package/docs/docs/cmd/planner/task/task-reference-add.mdx +19 -0
- package/docs/docs/cmd/planner/task/task-reference-list.mdx +19 -0
- package/docs/docs/cmd/planner/task/task-reference-remove.mdx +21 -0
- package/docs/docs/cmd/planner/task/task-remove.mdx +21 -0
- package/docs/docs/cmd/planner/task/task-set.mdx +19 -0
- package/docs/docs/cmd/planner/tenant/tenant-settings-list.mdx +44 -7
- package/docs/docs/cmd/planner/tenant/tenant-settings-set.mdx +43 -8
- package/docs/docs/cmd/pp/solution/solution-publisher-list.mdx +7 -4
- package/docs/docs/cmd/purview/threatassessment/threatassessment-get.mdx +7 -4
- package/docs/docs/cmd/spo/file/file-move.mdx +4 -1
- package/docs/docs/cmd/spo/hubsite/hubsite-get.mdx +6 -3
- package/docs/docs/cmd/spo/hubsite/hubsite-list.mdx +7 -4
- package/docs/docs/cmd/spo/list/list-add.mdx +1 -1
- package/docs/docs/cmd/spo/list/list-set.mdx +2 -2
- package/docs/docs/cmd/spo/page/page-control-remove.mdx +56 -0
- package/docs/docs/cmd/spo/tenant/tenant-site-list.mdx +10 -7
- package/docs/docs/cmd/spo/term/term-list.mdx +7 -4
- package/docs/docs/cmd/teams/chat/chat-member-add.mdx +6 -3
- package/docs/docs/cmd/viva/engage/engage-community-remove.mdx +61 -0
- package/docs/docs/cmd/viva/engage/engage-network-list.mdx +7 -4
- package/npm-shrinkwrap.json +112 -97
- package/package.json +17 -14
package/dist/cli/cli.js
CHANGED
|
@@ -34,7 +34,7 @@ let currentCommandName;
|
|
|
34
34
|
let optionsFromArgs;
|
|
35
35
|
const defaultHelpMode = 'options';
|
|
36
36
|
const defaultHelpTarget = 'console';
|
|
37
|
-
const helpModes = ['options', 'examples', 'remarks', 'response', 'full'];
|
|
37
|
+
const helpModes = ['options', 'examples', 'remarks', 'permissions', 'response', 'full'];
|
|
38
38
|
const helpTargets = ['console', 'web'];
|
|
39
39
|
const yargsConfiguration = {
|
|
40
40
|
'parse-numbers': true,
|
|
@@ -3,7 +3,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
3
3
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
|
-
var _EntraM365GroupGetCommand_instances, _EntraM365GroupGetCommand_initOptions, _EntraM365GroupGetCommand_initValidators, _EntraM365GroupGetCommand_initOptionSets, _EntraM365GroupGetCommand_initTypes;
|
|
6
|
+
var _EntraM365GroupGetCommand_instances, _EntraM365GroupGetCommand_initTelemetry, _EntraM365GroupGetCommand_initOptions, _EntraM365GroupGetCommand_initValidators, _EntraM365GroupGetCommand_initOptionSets, _EntraM365GroupGetCommand_initTypes;
|
|
7
7
|
import request from '../../../../request.js';
|
|
8
8
|
import { entraGroup } from '../../../../utils/entraGroup.js';
|
|
9
9
|
import { validation } from '../../../../utils/validation.js';
|
|
@@ -19,12 +19,16 @@ class EntraM365GroupGetCommand extends GraphCommand {
|
|
|
19
19
|
constructor() {
|
|
20
20
|
super();
|
|
21
21
|
_EntraM365GroupGetCommand_instances.add(this);
|
|
22
|
+
__classPrivateFieldGet(this, _EntraM365GroupGetCommand_instances, "m", _EntraM365GroupGetCommand_initTelemetry).call(this);
|
|
22
23
|
__classPrivateFieldGet(this, _EntraM365GroupGetCommand_instances, "m", _EntraM365GroupGetCommand_initOptions).call(this);
|
|
23
24
|
__classPrivateFieldGet(this, _EntraM365GroupGetCommand_instances, "m", _EntraM365GroupGetCommand_initValidators).call(this);
|
|
24
25
|
__classPrivateFieldGet(this, _EntraM365GroupGetCommand_instances, "m", _EntraM365GroupGetCommand_initOptionSets).call(this);
|
|
25
26
|
__classPrivateFieldGet(this, _EntraM365GroupGetCommand_instances, "m", _EntraM365GroupGetCommand_initTypes).call(this);
|
|
26
27
|
}
|
|
27
28
|
async commandAction(logger, args) {
|
|
29
|
+
if (args.options.includeSiteUrl) {
|
|
30
|
+
await this.warn(logger, `Parameter 'includeSiteUrl' is deprecated. Please use 'withSiteUrl' instead`);
|
|
31
|
+
}
|
|
28
32
|
let group;
|
|
29
33
|
try {
|
|
30
34
|
if (args.options.id) {
|
|
@@ -46,7 +50,7 @@ class EntraM365GroupGetCommand extends GraphCommand {
|
|
|
46
50
|
};
|
|
47
51
|
const groupExtended = await request.get(requestExtendedOptions);
|
|
48
52
|
group = { ...group, ...groupExtended };
|
|
49
|
-
if (args.options.includeSiteUrl) {
|
|
53
|
+
if (args.options.includeSiteUrl || args.options.withSiteUrl) {
|
|
50
54
|
const requestOptions = {
|
|
51
55
|
url: `${this.resource}/v1.0/groups/${group.id}/drive?$select=webUrl`,
|
|
52
56
|
headers: {
|
|
@@ -64,13 +68,22 @@ class EntraM365GroupGetCommand extends GraphCommand {
|
|
|
64
68
|
}
|
|
65
69
|
}
|
|
66
70
|
}
|
|
67
|
-
_EntraM365GroupGetCommand_instances = new WeakSet(),
|
|
71
|
+
_EntraM365GroupGetCommand_instances = new WeakSet(), _EntraM365GroupGetCommand_initTelemetry = function _EntraM365GroupGetCommand_initTelemetry() {
|
|
72
|
+
this.telemetry.push((args) => {
|
|
73
|
+
Object.assign(this.telemetryProperties, {
|
|
74
|
+
includeSiteUrl: !!args.options.includeSiteUrl,
|
|
75
|
+
withSiteUrl: !!args.options.withSiteUrl
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}, _EntraM365GroupGetCommand_initOptions = function _EntraM365GroupGetCommand_initOptions() {
|
|
68
79
|
this.options.unshift({
|
|
69
80
|
option: '-i, --id [id]'
|
|
70
81
|
}, {
|
|
71
82
|
option: '-n, --displayName [displayName]'
|
|
72
83
|
}, {
|
|
73
84
|
option: '--includeSiteUrl'
|
|
85
|
+
}, {
|
|
86
|
+
option: '--withSiteUrl'
|
|
74
87
|
});
|
|
75
88
|
}, _EntraM365GroupGetCommand_initValidators = function _EntraM365GroupGetCommand_initValidators() {
|
|
76
89
|
this.validators.push(async (args) => {
|
|
@@ -26,6 +26,9 @@ class EntraM365GroupListCommand extends GraphCommand {
|
|
|
26
26
|
return ['id', 'displayName', 'mailNickname', 'siteUrl'];
|
|
27
27
|
}
|
|
28
28
|
async commandAction(logger, args) {
|
|
29
|
+
if (args.options.includeSiteUrl) {
|
|
30
|
+
await this.warn(logger, `Parameter 'includeSiteUrl' is deprecated. Please use 'withSiteUrl' instead`);
|
|
31
|
+
}
|
|
29
32
|
const groupFilter = `?$filter=groupTypes/any(c:c+eq+'Unified')`;
|
|
30
33
|
const displayNameFilter = args.options.displayName ? ` and startswith(DisplayName,'${formatting.encodeQueryParameter(args.options.displayName)}')` : '';
|
|
31
34
|
const mailNicknameFilter = args.options.mailNickname ? ` and startswith(MailNickname,'${formatting.encodeQueryParameter(args.options.mailNickname)}')` : '';
|
|
@@ -43,7 +46,7 @@ class EntraM365GroupListCommand extends GraphCommand {
|
|
|
43
46
|
});
|
|
44
47
|
groups = orphanedGroups;
|
|
45
48
|
}
|
|
46
|
-
if (args.options.includeSiteUrl) {
|
|
49
|
+
if (args.options.includeSiteUrl || args.options.withSiteUrl) {
|
|
47
50
|
const res = await Promise.all(groups.map(g => this.getGroupSiteUrl(g.id)));
|
|
48
51
|
res.forEach(r => {
|
|
49
52
|
for (let i = 0; i < groups.length; i++) {
|
|
@@ -82,6 +85,7 @@ _EntraM365GroupListCommand_instances = new WeakSet(), _EntraM365GroupListCommand
|
|
|
82
85
|
displayName: typeof args.options.displayName !== 'undefined',
|
|
83
86
|
mailNickname: typeof args.options.mailNickname !== 'undefined',
|
|
84
87
|
includeSiteUrl: args.options.includeSiteUrl,
|
|
88
|
+
withSiteUrl: !!args.options.withSiteUrl,
|
|
85
89
|
orphaned: !!args.options.orphaned
|
|
86
90
|
});
|
|
87
91
|
});
|
|
@@ -92,6 +96,8 @@ _EntraM365GroupListCommand_instances = new WeakSet(), _EntraM365GroupListCommand
|
|
|
92
96
|
option: '-m, --mailNickname [displayName]'
|
|
93
97
|
}, {
|
|
94
98
|
option: '--includeSiteUrl'
|
|
99
|
+
}, {
|
|
100
|
+
option: '--withSiteUrl'
|
|
95
101
|
}, {
|
|
96
102
|
option: '--orphaned'
|
|
97
103
|
});
|
|
@@ -29,6 +29,9 @@ class EntraPimRoleAssignmentEligibilityListCommand extends GraphCommand {
|
|
|
29
29
|
__classPrivateFieldGet(this, _EntraPimRoleAssignmentEligibilityListCommand_instances, "m", _EntraPimRoleAssignmentEligibilityListCommand_initOptionSets).call(this);
|
|
30
30
|
}
|
|
31
31
|
async commandAction(logger, args) {
|
|
32
|
+
if (args.options.includePrincipalDetails) {
|
|
33
|
+
await this.warn(logger, `Parameter 'includePrincipalDetails' is deprecated. Please use 'withPrincipalDetails' instead`);
|
|
34
|
+
}
|
|
32
35
|
if (this.verbose) {
|
|
33
36
|
await logger.logToStderr(`Retrieving list of eligible roles for ${args.options.userId || args.options.userName || args.options.groupId || args.options.groupName || 'all users'}...`);
|
|
34
37
|
}
|
|
@@ -40,7 +43,7 @@ class EntraPimRoleAssignmentEligibilityListCommand extends GraphCommand {
|
|
|
40
43
|
queryParameters.push(`$filter=principalId eq '${principalId}'`);
|
|
41
44
|
}
|
|
42
45
|
expands.push('roleDefinition($select=displayName)');
|
|
43
|
-
if (args.options.includePrincipalDetails) {
|
|
46
|
+
if (args.options.includePrincipalDetails || args.options.withPrincipalDetails) {
|
|
44
47
|
expands.push('principal');
|
|
45
48
|
}
|
|
46
49
|
queryParameters.push(`$expand=${expands.join(',')}`);
|
|
@@ -86,7 +89,8 @@ _EntraPimRoleAssignmentEligibilityListCommand_instances = new WeakSet(), _EntraP
|
|
|
86
89
|
userName: typeof args.options.userName !== 'undefined',
|
|
87
90
|
groupId: typeof args.options.groupId !== 'undefined',
|
|
88
91
|
groupName: typeof args.options.groupName !== 'undefined',
|
|
89
|
-
includePrincipalDetails: !!args.options.includePrincipalDetails
|
|
92
|
+
includePrincipalDetails: !!args.options.includePrincipalDetails,
|
|
93
|
+
withPrincipalDetails: !!args.options.withPrincipalDetails
|
|
90
94
|
});
|
|
91
95
|
});
|
|
92
96
|
}, _EntraPimRoleAssignmentEligibilityListCommand_initOptions = function _EntraPimRoleAssignmentEligibilityListCommand_initOptions() {
|
|
@@ -99,7 +103,9 @@ _EntraPimRoleAssignmentEligibilityListCommand_instances = new WeakSet(), _EntraP
|
|
|
99
103
|
}, {
|
|
100
104
|
option: '--groupName [groupName]'
|
|
101
105
|
}, {
|
|
102
|
-
option: '--includePrincipalDetails
|
|
106
|
+
option: '--includePrincipalDetails'
|
|
107
|
+
}, {
|
|
108
|
+
option: '--withPrincipalDetails'
|
|
103
109
|
});
|
|
104
110
|
}, _EntraPimRoleAssignmentEligibilityListCommand_initValidators = function _EntraPimRoleAssignmentEligibilityListCommand_initValidators() {
|
|
105
111
|
this.validators.push(async (args) => {
|
|
@@ -30,6 +30,9 @@ class EntraPimRoleAssignmentListCommand extends GraphCommand {
|
|
|
30
30
|
const filters = [];
|
|
31
31
|
const expands = [];
|
|
32
32
|
try {
|
|
33
|
+
if (args.options.includePrincipalDetails) {
|
|
34
|
+
await this.warn(logger, `Parameter 'includePrincipalDetails' is deprecated. Please use 'withPrincipalDetails' instead`);
|
|
35
|
+
}
|
|
33
36
|
const principalId = await this.getPrincipalId(logger, args.options);
|
|
34
37
|
if (principalId) {
|
|
35
38
|
filters.push(`principalId eq '${principalId}'`);
|
|
@@ -41,7 +44,7 @@ class EntraPimRoleAssignmentListCommand extends GraphCommand {
|
|
|
41
44
|
queryParameters.push(`$filter=${filters.join(' and ')}`);
|
|
42
45
|
}
|
|
43
46
|
expands.push('roleDefinition($select=displayName)');
|
|
44
|
-
if (args.options.includePrincipalDetails) {
|
|
47
|
+
if (args.options.includePrincipalDetails || args.options.withPrincipalDetails) {
|
|
45
48
|
expands.push('principal');
|
|
46
49
|
}
|
|
47
50
|
queryParameters.push(`$expand=${expands.join(',')}`);
|
|
@@ -82,7 +85,8 @@ _EntraPimRoleAssignmentListCommand_instances = new WeakSet(), _EntraPimRoleAssig
|
|
|
82
85
|
groupId: typeof args.options.groupId !== 'undefined',
|
|
83
86
|
groupName: typeof args.options.groupName !== 'undefined',
|
|
84
87
|
startDateTime: typeof args.options.startDateTime !== 'undefined',
|
|
85
|
-
includePrincipalDetails: !!args.options.includePrincipalDetails
|
|
88
|
+
includePrincipalDetails: !!args.options.includePrincipalDetails,
|
|
89
|
+
withPrincipalDetails: !!args.options.withPrincipalDetails
|
|
86
90
|
});
|
|
87
91
|
});
|
|
88
92
|
}, _EntraPimRoleAssignmentListCommand_initOptions = function _EntraPimRoleAssignmentListCommand_initOptions() {
|
|
@@ -97,7 +101,9 @@ _EntraPimRoleAssignmentListCommand_instances = new WeakSet(), _EntraPimRoleAssig
|
|
|
97
101
|
}, {
|
|
98
102
|
option: "-s, --startDateTime [startDateTime]"
|
|
99
103
|
}, {
|
|
100
|
-
option: "--includePrincipalDetails
|
|
104
|
+
option: "--includePrincipalDetails"
|
|
105
|
+
}, {
|
|
106
|
+
option: "--withPrincipalDetails"
|
|
101
107
|
});
|
|
102
108
|
}, _EntraPimRoleAssignmentListCommand_initValidators = function _EntraPimRoleAssignmentListCommand_initValidators() {
|
|
103
109
|
this.validators.push(async (args) => {
|
|
@@ -30,6 +30,9 @@ class EntraPimRoleRequestListCommand extends GraphCommand {
|
|
|
30
30
|
__classPrivateFieldGet(this, _EntraPimRoleRequestListCommand_instances, "m", _EntraPimRoleRequestListCommand_initOptionSets).call(this);
|
|
31
31
|
}
|
|
32
32
|
async commandAction(logger, args) {
|
|
33
|
+
if (args.options.includePrincipalDetails) {
|
|
34
|
+
await this.warn(logger, `Parameter 'includePrincipalDetails' is deprecated. Please use 'withPrincipalDetails' instead`);
|
|
35
|
+
}
|
|
33
36
|
if (this.verbose) {
|
|
34
37
|
await logger.logToStderr(`Retrieving list of PIM roles requests for ${args.options.userId || args.options.userName || args.options.groupId || args.options.groupName || 'all users'}...`);
|
|
35
38
|
}
|
|
@@ -51,7 +54,7 @@ class EntraPimRoleRequestListCommand extends GraphCommand {
|
|
|
51
54
|
queryParameters.push(`$filter=${filters.join(' and ')}`);
|
|
52
55
|
}
|
|
53
56
|
expands.push('roleDefinition($select=displayName)');
|
|
54
|
-
if (args.options.includePrincipalDetails) {
|
|
57
|
+
if (args.options.includePrincipalDetails || args.options.withPrincipalDetails) {
|
|
55
58
|
expands.push('principal');
|
|
56
59
|
}
|
|
57
60
|
queryParameters.push(`$expand=${expands.join(',')}`);
|
|
@@ -100,7 +103,8 @@ _EntraPimRoleRequestListCommand_instances = new WeakSet(), _EntraPimRoleRequestL
|
|
|
100
103
|
groupName: typeof args.options.groupName !== 'undefined',
|
|
101
104
|
createdDateTime: typeof args.options.createdDateTime !== 'undefined',
|
|
102
105
|
status: typeof args.options.status !== 'undefined',
|
|
103
|
-
includePrincipalDetails: !!args.options.includePrincipalDetails
|
|
106
|
+
includePrincipalDetails: !!args.options.includePrincipalDetails,
|
|
107
|
+
withPrincipalDetails: !!args.options.withPrincipalDetails
|
|
104
108
|
});
|
|
105
109
|
});
|
|
106
110
|
}, _EntraPimRoleRequestListCommand_initOptions = function _EntraPimRoleRequestListCommand_initOptions() {
|
|
@@ -118,7 +122,9 @@ _EntraPimRoleRequestListCommand_instances = new WeakSet(), _EntraPimRoleRequestL
|
|
|
118
122
|
option: '-s, --status [status]',
|
|
119
123
|
autocomplete: this.allowedStatuses
|
|
120
124
|
}, {
|
|
121
|
-
option: '--includePrincipalDetails
|
|
125
|
+
option: '--includePrincipalDetails'
|
|
126
|
+
}, {
|
|
127
|
+
option: '--withPrincipalDetails'
|
|
122
128
|
});
|
|
123
129
|
}, _EntraPimRoleRequestListCommand_initValidators = function _EntraPimRoleRequestListCommand_initValidators() {
|
|
124
130
|
this.validators.push(async (args) => {
|
|
@@ -63,7 +63,7 @@ class FileCopyCommand extends GraphCommand {
|
|
|
63
63
|
async getCopyUrl(options, sourcePath, logger) {
|
|
64
64
|
const { webUrl, sourceUrl, verbose, nameConflictBehavior } = options;
|
|
65
65
|
const folderUrl = new URL(sourcePath);
|
|
66
|
-
const siteId = await spo.
|
|
66
|
+
const siteId = await spo.getSiteIdByMSGraph(webUrl, logger, verbose);
|
|
67
67
|
const drive = await this.getDocumentLibrary(siteId, folderUrl, sourceUrl, logger);
|
|
68
68
|
const itemId = await this.getStartingFolderId(drive, folderUrl, logger);
|
|
69
69
|
const queryParameters = nameConflictBehavior && nameConflictBehavior !== 'fail'
|
|
@@ -74,7 +74,7 @@ class FileCopyCommand extends GraphCommand {
|
|
|
74
74
|
}
|
|
75
75
|
async getTargetDriveAndItemId(webUrl, targetUrl, logger, verbose) {
|
|
76
76
|
const targetSiteUrl = urlUtil.getTargetSiteAbsoluteUrl(webUrl, targetUrl);
|
|
77
|
-
const targetSiteId = await spo.
|
|
77
|
+
const targetSiteId = await spo.getSiteIdByMSGraph(targetSiteUrl, logger, verbose);
|
|
78
78
|
const targetFolderUrl = new URL(this.getAbsoluteUrl(targetSiteUrl, targetUrl));
|
|
79
79
|
const targetDrive = await this.getDocumentLibrary(targetSiteId, targetFolderUrl, targetUrl, logger);
|
|
80
80
|
const targetDriveId = targetDrive.id;
|
|
@@ -59,7 +59,7 @@ class FileMoveCommand extends GraphCommand {
|
|
|
59
59
|
return url.startsWith('https://') ? url : urlUtil.getAbsoluteUrl(webUrl, url);
|
|
60
60
|
}
|
|
61
61
|
async getDriveIdAndItemId(webUrl, folderUrl, sourceUrl, logger, verbose) {
|
|
62
|
-
const siteId = await spo.
|
|
62
|
+
const siteId = await spo.getSiteIdByMSGraph(webUrl, logger, verbose);
|
|
63
63
|
const driveDetails = await drive.getDriveByUrl(siteId, new URL(folderUrl), logger, verbose);
|
|
64
64
|
const itemId = await drive.getDriveItemId(driveDetails, new URL(folderUrl), logger, verbose);
|
|
65
65
|
return { driveId: driveDetails.id, itemId };
|
|
@@ -28,29 +28,33 @@ class FlowListCommand extends PowerAutomateCommand {
|
|
|
28
28
|
__classPrivateFieldGet(this, _FlowListCommand_instances, "m", _FlowListCommand_initTypes).call(this);
|
|
29
29
|
}
|
|
30
30
|
async commandAction(logger, args) {
|
|
31
|
+
if (args.options.includeSolutions) {
|
|
32
|
+
await this.warn(logger, `Parameter 'includeSolutions' is deprecated. Please use 'withSolutions' instead`);
|
|
33
|
+
}
|
|
31
34
|
if (this.verbose) {
|
|
32
35
|
await logger.logToStderr(`Getting Power Automate flows${args.options.asAdmin ? ' as admin' : ''} in environment '${args.options.environmentName}'...`);
|
|
33
36
|
}
|
|
34
37
|
try {
|
|
35
|
-
const { environmentName, asAdmin, sharingStatus, includeSolutions } = args.options;
|
|
38
|
+
const { environmentName, asAdmin, sharingStatus, includeSolutions, withSolutions } = args.options;
|
|
36
39
|
let items = [];
|
|
40
|
+
const shouldIncludeSolutions = withSolutions || includeSolutions;
|
|
37
41
|
if (sharingStatus === 'personal') {
|
|
38
|
-
const url = this.getApiUrl(environmentName, asAdmin,
|
|
42
|
+
const url = this.getApiUrl(environmentName, asAdmin, shouldIncludeSolutions, 'personal');
|
|
39
43
|
items = await odata.getAllItems(url);
|
|
40
44
|
}
|
|
41
45
|
else if (sharingStatus === 'sharedWithMe') {
|
|
42
|
-
const url = this.getApiUrl(environmentName, asAdmin,
|
|
46
|
+
const url = this.getApiUrl(environmentName, asAdmin, shouldIncludeSolutions, 'team');
|
|
43
47
|
items = await odata.getAllItems(url);
|
|
44
48
|
}
|
|
45
49
|
else if (sharingStatus === 'all') {
|
|
46
|
-
let url = this.getApiUrl(environmentName, asAdmin,
|
|
50
|
+
let url = this.getApiUrl(environmentName, asAdmin, shouldIncludeSolutions, 'personal');
|
|
47
51
|
items = await odata.getAllItems(url);
|
|
48
|
-
url = this.getApiUrl(environmentName, asAdmin,
|
|
52
|
+
url = this.getApiUrl(environmentName, asAdmin, shouldIncludeSolutions, 'team');
|
|
49
53
|
const teamFlows = await odata.getAllItems(url);
|
|
50
54
|
items = items.concat(teamFlows);
|
|
51
55
|
}
|
|
52
56
|
else {
|
|
53
|
-
const url = this.getApiUrl(environmentName, asAdmin,
|
|
57
|
+
const url = this.getApiUrl(environmentName, asAdmin, shouldIncludeSolutions);
|
|
54
58
|
items = await odata.getAllItems(url);
|
|
55
59
|
}
|
|
56
60
|
// Remove duplicates
|
|
@@ -81,6 +85,7 @@ _FlowListCommand_instances = new WeakSet(), _FlowListCommand_initTelemetry = fun
|
|
|
81
85
|
Object.assign(this.telemetryProperties, {
|
|
82
86
|
sharingStatus: typeof args.options.sharingStatus !== 'undefined',
|
|
83
87
|
includeSolutions: !!args.options.includeSolutions,
|
|
88
|
+
withSolutions: !!args.options.withSolutions,
|
|
84
89
|
asAdmin: !!args.options.asAdmin
|
|
85
90
|
});
|
|
86
91
|
});
|
|
@@ -92,6 +97,8 @@ _FlowListCommand_instances = new WeakSet(), _FlowListCommand_initTelemetry = fun
|
|
|
92
97
|
autocomplete: this.allowedSharingStatuses
|
|
93
98
|
}, {
|
|
94
99
|
option: '--includeSolutions'
|
|
100
|
+
}, {
|
|
101
|
+
option: '--withSolutions'
|
|
95
102
|
}, {
|
|
96
103
|
option: '--asAdmin'
|
|
97
104
|
});
|
|
@@ -107,7 +114,7 @@ _FlowListCommand_instances = new WeakSet(), _FlowListCommand_initTelemetry = fun
|
|
|
107
114
|
});
|
|
108
115
|
}, _FlowListCommand_initTypes = function _FlowListCommand_initTypes() {
|
|
109
116
|
this.types.string.push('environmentName', 'sharingStatus');
|
|
110
|
-
this.types.boolean.push('includeSolutions', 'asAdmin');
|
|
117
|
+
this.types.boolean.push('includeSolutions', 'withSolutions', 'asAdmin');
|
|
111
118
|
};
|
|
112
119
|
export default new FlowListCommand();
|
|
113
120
|
//# sourceMappingURL=flow-list.js.map
|
|
@@ -28,7 +28,7 @@ class FlowRunGetCommand extends PowerAutomateCommand {
|
|
|
28
28
|
await logger.logToStderr(`Retrieving information about run ${args.options.name} of Microsoft Flow ${args.options.flowName}...`);
|
|
29
29
|
}
|
|
30
30
|
if (args.options.includeTriggerInformation) {
|
|
31
|
-
await this.warn(logger, `Parameter 'includeTriggerInformation' is deprecated. Please use 'withTrigger instead`);
|
|
31
|
+
await this.warn(logger, `Parameter 'includeTriggerInformation' is deprecated. Please use 'withTrigger' instead`);
|
|
32
32
|
}
|
|
33
33
|
const actionsParameter = args.options.withActions ? '$expand=properties%2Factions&' : '';
|
|
34
34
|
const requestOptions = {
|
|
@@ -49,7 +49,7 @@ class GraphSubscriptionAddCommand extends GraphCommand {
|
|
|
49
49
|
notificationUrl: args.options.notificationUrl,
|
|
50
50
|
expirationDateTime: await this.getExpirationDateTimeOrDefault(logger, args),
|
|
51
51
|
clientState: args.options.clientState,
|
|
52
|
-
includeResourceData: args.options.includeResourceData,
|
|
52
|
+
includeResourceData: args.options.withResourceData || args.options.includeResourceData,
|
|
53
53
|
encryptionCertificate: args.options.encryptionCertificate,
|
|
54
54
|
encryptionCertificateId: args.options.encryptionCertificateId,
|
|
55
55
|
lifecycleNotificationUrl: args.options.lifecycleNotificationUrl,
|
|
@@ -66,6 +66,9 @@ class GraphSubscriptionAddCommand extends GraphCommand {
|
|
|
66
66
|
responseType: 'json'
|
|
67
67
|
};
|
|
68
68
|
try {
|
|
69
|
+
if (args.options.includeResourceData) {
|
|
70
|
+
await this.warn(logger, `Parameter 'includeResourceData' is deprecated. Please use 'withResourceData' instead`);
|
|
71
|
+
}
|
|
69
72
|
const res = await request.post(requestOptions);
|
|
70
73
|
await logger.log(res);
|
|
71
74
|
}
|
|
@@ -133,6 +136,7 @@ _GraphSubscriptionAddCommand_instances = new WeakSet(), _GraphSubscriptionAddCom
|
|
|
133
136
|
notificationUrlAppId: typeof args.options.notificationUrlAppId !== 'undefined',
|
|
134
137
|
latestTLSVersion: typeof args.options.latestTLSVersion !== 'undefined',
|
|
135
138
|
includeResourceData: !!args.options.includeResourceData,
|
|
139
|
+
withResourceData: !!args.options.withResourceData,
|
|
136
140
|
encryptionCertificate: typeof args.options.encryptionCertificate !== 'undefined',
|
|
137
141
|
encryptionCertificateId: typeof args.options.encryptionCertificateId !== 'undefined'
|
|
138
142
|
});
|
|
@@ -158,6 +162,8 @@ _GraphSubscriptionAddCommand_instances = new WeakSet(), _GraphSubscriptionAddCom
|
|
|
158
162
|
autocomplete: this.allowedTlsVersions
|
|
159
163
|
}, {
|
|
160
164
|
option: '--includeResourceData [includeResourceData]'
|
|
165
|
+
}, {
|
|
166
|
+
option: '--withResourceData [withResourceData]'
|
|
161
167
|
}, {
|
|
162
168
|
option: '--encryptionCertificate [encryptionCertificate]'
|
|
163
169
|
}, {
|
|
@@ -187,10 +193,11 @@ _GraphSubscriptionAddCommand_instances = new WeakSet(), _GraphSubscriptionAddCom
|
|
|
187
193
|
if (args.options.latestTLSVersion && this.allowedTlsVersions.map(x => x.toLowerCase()).indexOf(args.options.latestTLSVersion.toLowerCase()) === -1) {
|
|
188
194
|
return `${args.options.latestTLSVersion} is not a valid TLS version. Allowed values are ${this.allowedTlsVersions.join(', ')}`;
|
|
189
195
|
}
|
|
190
|
-
|
|
196
|
+
const shouldIncludeResourceData = args.options.includeResourceData || args.options.withResourceData;
|
|
197
|
+
if (shouldIncludeResourceData && !args.options.encryptionCertificate) {
|
|
191
198
|
return `The 'encryptionCertificate' options is required to include the changed resource data`;
|
|
192
199
|
}
|
|
193
|
-
if (
|
|
200
|
+
if (shouldIncludeResourceData && !args.options.encryptionCertificateId) {
|
|
194
201
|
return `The 'encryptionCertificateId' options is required to include the changed resource data`;
|
|
195
202
|
}
|
|
196
203
|
if (args.options.notificationUrlAppId && !validation.isValidGuid(args.options.notificationUrlAppId)) {
|
|
@@ -8,9 +8,6 @@ class PlannerTenantSettingsListCommand extends PlannerCommand {
|
|
|
8
8
|
get description() {
|
|
9
9
|
return 'Lists the Microsoft Planner configuration of the tenant';
|
|
10
10
|
}
|
|
11
|
-
defaultProperties() {
|
|
12
|
-
return ['isPlannerAllowed', 'allowCalendarSharing', 'allowTenantMoveWithDataLoss', 'allowTenantMoveWithDataMigration', 'allowRosterCreation', 'allowPlannerMobilePushNotifications'];
|
|
13
|
-
}
|
|
14
11
|
async commandAction(logger) {
|
|
15
12
|
const requestOptions = {
|
|
16
13
|
url: `${this.resource}/taskAPI/tenantAdminSettings/Settings`,
|
|
@@ -25,13 +25,17 @@ class PpSolutionPublisherListCommand extends PowerPlatformCommand {
|
|
|
25
25
|
__classPrivateFieldGet(this, _PpSolutionPublisherListCommand_instances, "m", _PpSolutionPublisherListCommand_initOptions).call(this);
|
|
26
26
|
}
|
|
27
27
|
async commandAction(logger, args) {
|
|
28
|
+
if (args.options.includeMicrosoftPublishers) {
|
|
29
|
+
await this.warn(logger, `Parameter 'includeMicrosoftPublishers' is deprecated. Please use 'withMicrosoftPublishers' instead`);
|
|
30
|
+
}
|
|
28
31
|
if (this.verbose) {
|
|
29
32
|
await logger.logToStderr(`Retrieving list of publishers...`);
|
|
30
33
|
}
|
|
31
34
|
try {
|
|
32
35
|
const dynamicsApiUrl = await powerPlatform.getDynamicsInstanceApiUrl(args.options.environmentName, args.options.asAdmin);
|
|
36
|
+
const shouldIncludeMicrosoftPublishers = args.options.withMicrosoftPublishers || args.options.includeMicrosoftPublishers;
|
|
33
37
|
const requestOptions = {
|
|
34
|
-
url: `${dynamicsApiUrl}/api/data/v9.0/publishers?$select=publisherid,uniquename,friendlyname,versionnumber,isreadonly,description,customizationprefix,customizationoptionvalueprefix${!
|
|
38
|
+
url: `${dynamicsApiUrl}/api/data/v9.0/publishers?$select=publisherid,uniquename,friendlyname,versionnumber,isreadonly,description,customizationprefix,customizationoptionvalueprefix${!shouldIncludeMicrosoftPublishers ? `&$filter=publisherid ne 'd21aab70-79e7-11dd-8874-00188b01e34f'` : ''}&api-version=9.1`,
|
|
35
39
|
headers: {
|
|
36
40
|
accept: 'application/json;odata.metadata=none'
|
|
37
41
|
},
|
|
@@ -49,6 +53,7 @@ _PpSolutionPublisherListCommand_instances = new WeakSet(), _PpSolutionPublisherL
|
|
|
49
53
|
this.telemetry.push((args) => {
|
|
50
54
|
Object.assign(this.telemetryProperties, {
|
|
51
55
|
includeMicrosoftPublishers: typeof args.options.includeMicrosoftPublishers !== 'undefined',
|
|
56
|
+
withMicrosoftPublishers: typeof args.options.withMicrosoftPublishers !== 'undefined',
|
|
52
57
|
asAdmin: !!args.options.asAdmin
|
|
53
58
|
});
|
|
54
59
|
});
|
|
@@ -57,6 +62,8 @@ _PpSolutionPublisherListCommand_instances = new WeakSet(), _PpSolutionPublisherL
|
|
|
57
62
|
option: '-e, --environmentName <environmentName>'
|
|
58
63
|
}, {
|
|
59
64
|
option: '--includeMicrosoftPublishers'
|
|
65
|
+
}, {
|
|
66
|
+
option: '--withMicrosoftPublishers'
|
|
60
67
|
}, {
|
|
61
68
|
option: '--asAdmin'
|
|
62
69
|
});
|
|
@@ -24,11 +24,15 @@ class PurviewThreatAssessmentGetCommand extends GraphCommand {
|
|
|
24
24
|
}
|
|
25
25
|
async commandAction(logger, args) {
|
|
26
26
|
try {
|
|
27
|
+
if (args.options.includeResults) {
|
|
28
|
+
await this.warn(logger, `Parameter 'includeResults' is deprecated. Please use 'withResults' instead`);
|
|
29
|
+
}
|
|
27
30
|
if (this.verbose) {
|
|
28
31
|
await logger.logToStderr(`Retrieving threat assessment with id ${args.options.id}`);
|
|
29
32
|
}
|
|
33
|
+
const shouldIncludeResults = args.options.includeResults || args.options.withResults;
|
|
30
34
|
const requestOptions = {
|
|
31
|
-
url: `${this.resource}/v1.0/informationProtection/threatAssessmentRequests/${args.options.id}${
|
|
35
|
+
url: `${this.resource}/v1.0/informationProtection/threatAssessmentRequests/${args.options.id}${shouldIncludeResults ? '?$expand=results' : ''}`,
|
|
32
36
|
headers: {
|
|
33
37
|
accept: 'application/json;odata.metadata=none'
|
|
34
38
|
},
|
|
@@ -45,7 +49,8 @@ class PurviewThreatAssessmentGetCommand extends GraphCommand {
|
|
|
45
49
|
_PurviewThreatAssessmentGetCommand_instances = new WeakSet(), _PurviewThreatAssessmentGetCommand_initTelemetry = function _PurviewThreatAssessmentGetCommand_initTelemetry() {
|
|
46
50
|
this.telemetry.push((args) => {
|
|
47
51
|
Object.assign(this.telemetryProperties, {
|
|
48
|
-
includeResults: !!args.options.includeResults
|
|
52
|
+
includeResults: !!args.options.includeResults,
|
|
53
|
+
withResults: !!args.options.withResults
|
|
49
54
|
});
|
|
50
55
|
});
|
|
51
56
|
}, _PurviewThreatAssessmentGetCommand_initOptions = function _PurviewThreatAssessmentGetCommand_initOptions() {
|
|
@@ -53,6 +58,8 @@ _PurviewThreatAssessmentGetCommand_instances = new WeakSet(), _PurviewThreatAsse
|
|
|
53
58
|
option: '-i, --id <id>'
|
|
54
59
|
}, {
|
|
55
60
|
option: '--includeResults'
|
|
61
|
+
}, {
|
|
62
|
+
option: '--withResults'
|
|
56
63
|
});
|
|
57
64
|
}, _PurviewThreatAssessmentGetCommand_initValidators = function _PurviewThreatAssessmentGetCommand_initValidators() {
|
|
58
65
|
this.validators.push(async (args) => {
|
|
@@ -9,7 +9,6 @@ import config from '../../../../config.js';
|
|
|
9
9
|
import request from '../../../../request.js';
|
|
10
10
|
import { formatting } from '../../../../utils/formatting.js';
|
|
11
11
|
import { spo } from '../../../../utils/spo.js';
|
|
12
|
-
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
13
12
|
import { validation } from '../../../../utils/validation.js';
|
|
14
13
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
15
14
|
import commands from '../../commands.js';
|
|
@@ -87,72 +86,11 @@ class SpoContentTypeAddCommand extends SpoCommand {
|
|
|
87
86
|
}
|
|
88
87
|
}
|
|
89
88
|
async getParentInfo(options, logger) {
|
|
90
|
-
const siteId = await
|
|
91
|
-
const webId = await
|
|
92
|
-
const listId = await
|
|
89
|
+
const siteId = await spo.getSiteIdBySPApi(options.webUrl, logger, this.verbose);
|
|
90
|
+
const webId = await spo.getWebId(options.webUrl, logger, this.verbose);
|
|
91
|
+
const listId = options.listId ? options.listId : await spo.getListId(options.webUrl, options.listTitle, options.listUrl, logger, this.verbose);
|
|
93
92
|
return `<Identity Id="5" Name="1a48869e-c092-0000-1f61-81ec89809537|740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:web:${webId}:list:${listId}" />`;
|
|
94
93
|
}
|
|
95
|
-
async getSiteId(webUrl, logger) {
|
|
96
|
-
if (this.verbose) {
|
|
97
|
-
await logger.logToStderr(`Retrieving site collection id...`);
|
|
98
|
-
}
|
|
99
|
-
const requestOptions = {
|
|
100
|
-
url: `${webUrl}/_api/site?$select=Id`,
|
|
101
|
-
headers: {
|
|
102
|
-
accept: 'application/json;odata=nometadata'
|
|
103
|
-
},
|
|
104
|
-
responseType: 'json'
|
|
105
|
-
};
|
|
106
|
-
const siteResponse = await request.get(requestOptions);
|
|
107
|
-
return siteResponse.Id;
|
|
108
|
-
}
|
|
109
|
-
async getWebId(webUrl, logger) {
|
|
110
|
-
if (this.verbose) {
|
|
111
|
-
await logger.logToStderr(`Retrieving web id...`);
|
|
112
|
-
}
|
|
113
|
-
const requestOptions = {
|
|
114
|
-
url: `${webUrl}/_api/web?$select=Id`,
|
|
115
|
-
headers: {
|
|
116
|
-
accept: 'application/json;odata=nometadata'
|
|
117
|
-
},
|
|
118
|
-
responseType: 'json'
|
|
119
|
-
};
|
|
120
|
-
const webResponse = await request.get(requestOptions);
|
|
121
|
-
return webResponse.Id;
|
|
122
|
-
}
|
|
123
|
-
async getListId(options, logger) {
|
|
124
|
-
if (this.verbose) {
|
|
125
|
-
await logger.logToStderr(`Retrieving list id...`);
|
|
126
|
-
}
|
|
127
|
-
let listId = '';
|
|
128
|
-
if (options.listId) {
|
|
129
|
-
return options.listId;
|
|
130
|
-
}
|
|
131
|
-
else if (options.listTitle) {
|
|
132
|
-
const requestOptions = {
|
|
133
|
-
url: `${options.webUrl}/_api/web/lists/getByTitle('${formatting.encodeQueryParameter(options.listTitle)}')?$select=Id`,
|
|
134
|
-
headers: {
|
|
135
|
-
accept: 'application/json;odata=nometadata'
|
|
136
|
-
},
|
|
137
|
-
responseType: 'json'
|
|
138
|
-
};
|
|
139
|
-
const listResponse = await request.get(requestOptions);
|
|
140
|
-
listId = listResponse.Id;
|
|
141
|
-
}
|
|
142
|
-
else if (options.listUrl) {
|
|
143
|
-
const listServerRelativeUrl = urlUtil.getServerRelativePath(options.webUrl, options.listUrl);
|
|
144
|
-
const requestOptions = {
|
|
145
|
-
url: `${options.webUrl}/_api/web/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')?$select=Id`,
|
|
146
|
-
headers: {
|
|
147
|
-
accept: 'application/json;odata=nometadata'
|
|
148
|
-
},
|
|
149
|
-
responseType: 'json'
|
|
150
|
-
};
|
|
151
|
-
const listResponse = await request.get(requestOptions);
|
|
152
|
-
listId = listResponse.Id;
|
|
153
|
-
}
|
|
154
|
-
return listId;
|
|
155
|
-
}
|
|
156
94
|
}
|
|
157
95
|
_SpoContentTypeAddCommand_instances = new WeakSet(), _SpoContentTypeAddCommand_initTelemetry = function _SpoContentTypeAddCommand_initTelemetry() {
|
|
158
96
|
this.telemetry.push((args) => {
|
|
@@ -8,7 +8,6 @@ import { cli } from '../../../../cli/cli.js';
|
|
|
8
8
|
import request from '../../../../request.js';
|
|
9
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
10
10
|
import { spo } from '../../../../utils/spo.js';
|
|
11
|
-
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
12
11
|
import { validation } from '../../../../utils/validation.js';
|
|
13
12
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
14
13
|
import commands from '../../commands.js';
|
|
@@ -33,30 +32,12 @@ class SpoContentTypeFieldRemoveCommand extends SpoCommand {
|
|
|
33
32
|
if (this.debug) {
|
|
34
33
|
await logger.logToStderr(`Get SiteId required by ProcessQuery endpoint.`);
|
|
35
34
|
}
|
|
36
|
-
|
|
37
|
-
let requestOptions = {
|
|
38
|
-
url: `${args.options.webUrl}/_api/site?$select=Id`,
|
|
39
|
-
headers: {
|
|
40
|
-
accept: 'application/json;odata=nometadata'
|
|
41
|
-
},
|
|
42
|
-
responseType: 'json'
|
|
43
|
-
};
|
|
44
|
-
const site = await request.get(requestOptions);
|
|
45
|
-
const siteId = site.Id;
|
|
35
|
+
const siteId = await spo.getSiteIdBySPApi(args.options.webUrl, logger, this.verbose);
|
|
46
36
|
if (this.debug) {
|
|
47
37
|
await logger.logToStderr(`SiteId: ${siteId}`);
|
|
48
38
|
await logger.logToStderr(`Get WebId required by ProcessQuery endpoint.`);
|
|
49
39
|
}
|
|
50
|
-
|
|
51
|
-
requestOptions = {
|
|
52
|
-
url: `${args.options.webUrl}/_api/web?$select=Id`,
|
|
53
|
-
headers: {
|
|
54
|
-
accept: 'application/json;odata=nometadata'
|
|
55
|
-
},
|
|
56
|
-
responseType: 'json'
|
|
57
|
-
};
|
|
58
|
-
const web = await request.get(requestOptions);
|
|
59
|
-
const webId = web.Id;
|
|
40
|
+
const webId = await spo.getWebId(args.options.webUrl, logger, this.verbose);
|
|
60
41
|
if (this.debug) {
|
|
61
42
|
await logger.logToStderr(`WebId: ${webId}`);
|
|
62
43
|
}
|
|
@@ -64,11 +45,8 @@ class SpoContentTypeFieldRemoveCommand extends SpoCommand {
|
|
|
64
45
|
if (args.options.listId) {
|
|
65
46
|
listId = args.options.listId;
|
|
66
47
|
}
|
|
67
|
-
|
|
68
|
-
listId = await
|
|
69
|
-
}
|
|
70
|
-
else if (args.options.listUrl) {
|
|
71
|
-
listId = await this.getListIdFromListUrl(args.options.webUrl, args.options.listUrl);
|
|
48
|
+
if (args.options.listTitle || args.options.listUrl) {
|
|
49
|
+
listId = await spo.getListId(args.options.webUrl, args.options.listTitle, args.options.listUrl, logger, this.verbose);
|
|
72
50
|
}
|
|
73
51
|
if (this.debug) {
|
|
74
52
|
await logger.logToStderr(`ListId: ${listId}`);
|
|
@@ -88,7 +66,7 @@ class SpoContentTypeFieldRemoveCommand extends SpoCommand {
|
|
|
88
66
|
else {
|
|
89
67
|
requestBody = `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName=".NET Library" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="77" ObjectPathId="76" /><ObjectPath Id="79" ObjectPathId="78" /><Method Name="DeleteObject" Id="80" ObjectPathId="78" /><Method Name="Update" Id="81" ObjectPathId="24"><Parameters><Parameter Type="Boolean">${updateChildContentTypes}</Parameter></Parameters></Method></Actions><ObjectPaths><Property Id="76" ParentId="24" Name="FieldLinks" /><Method Id="78" ParentId="76" Name="GetById"><Parameters><Parameter Type="Guid">{${formatting.escapeXml(args.options.id)}}</Parameter></Parameters></Method><Identity Id="24" Name="6b3ec69e-00a7-0000-55a3-61f8d779d2b3|740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:web:${webId}:contenttype:${formatting.escapeXml(args.options.contentTypeId)}" /></ObjectPaths></Request>`;
|
|
90
68
|
}
|
|
91
|
-
requestOptions = {
|
|
69
|
+
const requestOptions = {
|
|
92
70
|
url: `${args.options.webUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
93
71
|
headers: {
|
|
94
72
|
'X-RequestDigest': requestDigest
|
|
@@ -116,29 +94,6 @@ class SpoContentTypeFieldRemoveCommand extends SpoCommand {
|
|
|
116
94
|
}
|
|
117
95
|
}
|
|
118
96
|
}
|
|
119
|
-
async getListIdFromListTitle(webUrl, listTitle) {
|
|
120
|
-
const requestOptions = {
|
|
121
|
-
url: `${webUrl}/_api/lists/GetByTitle('${formatting.encodeQueryParameter(listTitle)}')?$select=Id`,
|
|
122
|
-
headers: {
|
|
123
|
-
accept: 'application/json;odata=nometadata'
|
|
124
|
-
},
|
|
125
|
-
responseType: 'json'
|
|
126
|
-
};
|
|
127
|
-
const list = await request.get(requestOptions);
|
|
128
|
-
return list.Id;
|
|
129
|
-
}
|
|
130
|
-
async getListIdFromListUrl(webUrl, listUrl) {
|
|
131
|
-
const listServerRelativeUrl = urlUtil.getServerRelativePath(webUrl, listUrl);
|
|
132
|
-
const requestOptions = {
|
|
133
|
-
url: `${webUrl}/_api/web/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')?$select=Id`,
|
|
134
|
-
headers: {
|
|
135
|
-
accept: 'application/json;odata=nometadata'
|
|
136
|
-
},
|
|
137
|
-
responseType: 'json'
|
|
138
|
-
};
|
|
139
|
-
const list = await request.get(requestOptions);
|
|
140
|
-
return list.Id;
|
|
141
|
-
}
|
|
142
97
|
}
|
|
143
98
|
_SpoContentTypeFieldRemoveCommand_instances = new WeakSet(), _SpoContentTypeFieldRemoveCommand_initTelemetry = function _SpoContentTypeFieldRemoveCommand_initTelemetry() {
|
|
144
99
|
this.telemetry.push((args) => {
|