@pnp/cli-microsoft365 10.0.0-beta.7dfc31a → 10.0.0-beta.a0367997
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/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Auth.js +17 -16
- package/dist/AuthServer.js +7 -7
- package/dist/Command.js +4 -1
- package/dist/api.js +1 -1
- package/dist/cli/cli.js +14 -0
- package/dist/config.js +61 -5
- package/dist/m365/base/PowerAutomateCommand.js +1 -1
- package/dist/m365/base/SpoCommand.js +1 -1
- package/dist/m365/cli/commands/cli-consent.js +2 -2
- package/dist/m365/cli/commands/cli-doctor.js +4 -4
- package/dist/m365/cli/commands/config/config-set.js +12 -4
- package/dist/m365/cli/commands.js +1 -2
- package/dist/m365/commands/login.js +28 -9
- package/dist/m365/commands/setup.js +256 -33
- package/dist/m365/commands/setupPresets.js +2 -4
- package/dist/m365/connection/commands/connection-list.js +4 -4
- package/dist/m365/entra/commands/app/app-add.js +52 -288
- package/dist/m365/entra/commands/m365group/m365group-set.js +24 -16
- package/dist/m365/entra/commands/m365group/m365group-user-add.js +5 -12
- package/dist/m365/entra/commands/oauth2grant/oauth2grant-list.js +3 -12
- package/dist/m365/external/commands/item/item-add.js +2 -5
- package/dist/m365/file/commands/file-move.js +135 -0
- package/dist/m365/file/commands.js +2 -1
- package/dist/m365/flow/commands/environment/environment-get.js +1 -1
- package/dist/m365/flow/commands/environment/environment-list.js +2 -2
- package/dist/m365/flow/commands/flow-disable.js +1 -1
- package/dist/m365/flow/commands/flow-enable.js +1 -1
- package/dist/m365/flow/commands/flow-export.js +17 -16
- package/dist/m365/flow/commands/flow-get.js +1 -1
- package/dist/m365/flow/commands/flow-list.js +1 -1
- package/dist/m365/flow/commands/flow-remove.js +1 -1
- package/dist/m365/flow/commands/owner/owner-ensure.js +1 -1
- package/dist/m365/flow/commands/owner/owner-list.js +1 -1
- package/dist/m365/flow/commands/owner/owner-remove.js +1 -1
- package/dist/m365/flow/commands/recyclebinitem/recyclebinitem-list.js +47 -0
- package/dist/m365/flow/commands/recyclebinitem/recyclebinitem-restore.js +48 -0
- package/dist/m365/flow/commands/run/run-cancel.js +1 -1
- package/dist/m365/flow/commands/run/run-get.js +1 -1
- package/dist/m365/flow/commands/run/run-list.js +1 -1
- package/dist/m365/flow/commands/run/run-resubmit.js +2 -2
- package/dist/m365/flow/commands.js +2 -0
- package/dist/m365/pa/commands/app/app-list.js +1 -6
- package/dist/m365/pa/commands/connector/connector-list.js +1 -6
- package/dist/m365/pa/commands/environment/environment-list.js +1 -1
- package/dist/m365/pp/commands/environment/environment-list.js +1 -1
- package/dist/m365/spfx/commands/project/project-doctor/doctor-1.20.0.js +27 -0
- package/dist/m365/spfx/commands/project/project-doctor/rules/FN002021_DEVDEP_rushstack_eslint_config.js +10 -0
- package/dist/m365/spfx/commands/project/project-doctor.js +2 -1
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.20.0.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-instance-list.js +3 -18
- package/dist/m365/spo/commands/app/app-list.js +1 -8
- package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +8 -8
- package/dist/m365/spo/commands/contenttype/contenttype-field-set.js +2 -2
- package/dist/m365/spo/commands/feature/feature-list.js +1 -8
- package/dist/m365/spo/commands/file/file-copy.js +5 -1
- package/dist/m365/spo/commands/file/file-move.js +55 -33
- package/dist/m365/spo/commands/file/file-roleassignment-add.js +17 -54
- package/dist/m365/spo/commands/file/file-roleassignment-remove.js +13 -40
- package/dist/m365/spo/commands/file/file-roleinheritance-break.js +5 -13
- package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +5 -13
- package/dist/m365/spo/commands/folder/folder-sharinglink-add.js +143 -0
- package/dist/m365/spo/commands/folder/folder-sharinglink-clear.js +111 -0
- package/dist/m365/spo/commands/folder/folder-sharinglink-remove.js +95 -0
- package/dist/m365/spo/commands/list/list-get.js +17 -4
- package/dist/m365/spo/commands/list/list-webhook-list.js +1 -6
- package/dist/m365/spo/commands/listitem/listitem-attachment-list.js +1 -8
- package/dist/m365/spo/commands/page/page-list.js +1 -1
- package/dist/m365/spo/commands/page/page-remove.js +37 -16
- package/dist/m365/spo/commands/page/page-section-add.js +185 -34
- package/dist/m365/spo/commands/page/page-template-list.js +1 -3
- package/dist/m365/spo/commands/site/SiteAdmin.js +2 -0
- package/dist/m365/spo/commands/site/site-admin-add.js +252 -0
- package/dist/m365/spo/commands/site/site-admin-list.js +10 -36
- package/dist/m365/spo/commands/site/site-admin-remove.js +194 -0
- package/dist/m365/spo/commands/site/site-sharingpermission-set.js +68 -0
- package/dist/m365/spo/commands/sitescript/sitescript-get.js +3 -2
- package/dist/m365/spo/commands/sitescript/sitescript-list.js +1 -3
- package/dist/m365/spo/commands/{site/site-rename.js → tenant/tenant-site-rename.js} +29 -32
- package/dist/m365/spo/commands/theme/theme-list.js +1 -1
- package/dist/m365/spo/commands/user/user-get.js +67 -9
- package/dist/m365/spo/commands/web/web-clientsidewebpart-list.js +1 -6
- package/dist/m365/spo/commands.js +7 -1
- package/dist/m365/spp/commands/contentcenter/contentcenter-list.js +56 -0
- package/dist/m365/spp/commands.js +5 -0
- package/dist/m365/teams/MeetingTranscript.js +2 -0
- package/dist/m365/teams/commands/meeting/meeting-transcript-get.js +152 -0
- package/dist/m365/teams/commands/tab/tab-list.js +5 -3
- package/dist/m365/teams/commands.js +1 -0
- package/dist/m365/viva/commands/engage/Community.js +2 -0
- package/dist/m365/viva/commands/engage/engage-community-list.js +28 -0
- package/dist/m365/viva/commands.js +1 -0
- package/dist/request.js +46 -61
- package/dist/settingsNames.js +6 -1
- package/dist/utils/driveUtil.js +51 -0
- package/dist/utils/entraApp.js +283 -0
- package/dist/utils/spo.js +76 -8
- package/dist/utils/timersUtil.js +12 -0
- package/dist/utils/urlUtil.js +8 -0
- package/dist/utils/zod.js +1 -1
- package/docs/docs/_clisettings.mdx +6 -1
- package/docs/docs/cmd/cli/cli-doctor.mdx +24 -23
- package/docs/docs/cmd/entra/m365group/m365group-report-activitystorage.mdx +2 -2
- package/docs/docs/cmd/entra/m365group/m365group-set.mdx +9 -6
- package/docs/docs/cmd/entra/m365group/m365group-user-add.mdx +0 -3
- package/docs/docs/cmd/external/item/item-add.mdx +3 -3
- package/docs/docs/cmd/file/file-move.mdx +79 -0
- package/docs/docs/cmd/flow/recyclebinitem/recyclebinitem-list.mdx +132 -0
- package/docs/docs/cmd/flow/recyclebinitem/recyclebinitem-restore.mdx +55 -0
- package/docs/docs/cmd/setup.mdx +17 -6
- package/docs/docs/cmd/spfx/project/project-upgrade.mdx +1 -1
- package/docs/docs/cmd/spo/cdn/cdn-get.mdx +1 -1
- package/docs/docs/cmd/spo/cdn/cdn-origin-add.mdx +1 -1
- package/docs/docs/cmd/spo/cdn/cdn-origin-list.mdx +1 -1
- package/docs/docs/cmd/spo/cdn/cdn-origin-remove.mdx +1 -1
- package/docs/docs/cmd/spo/cdn/cdn-policy-list.mdx +1 -1
- package/docs/docs/cmd/spo/cdn/cdn-policy-set.mdx +1 -1
- package/docs/docs/cmd/spo/contenttype/contenttype-field-remove.mdx +7 -7
- package/docs/docs/cmd/spo/contenttype/contenttype-field-set.mdx +2 -2
- package/docs/docs/cmd/spo/externaluser/externaluser-list.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-move.mdx +116 -9
- package/docs/docs/cmd/spo/folder/folder-sharinglink-add.mdx +125 -0
- package/docs/docs/cmd/spo/folder/folder-sharinglink-clear.mdx +50 -0
- package/docs/docs/cmd/spo/folder/folder-sharinglink-remove.mdx +50 -0
- package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-get.mdx +1 -1
- package/docs/docs/cmd/spo/hidedefaultthemes/hidedefaultthemes-set.mdx +1 -1
- package/docs/docs/cmd/spo/homesite/homesite-remove.mdx +1 -1
- package/docs/docs/cmd/spo/knowledgehub/knowledgehub-get.mdx +1 -1
- package/docs/docs/cmd/spo/knowledgehub/knowledgehub-remove.mdx +1 -1
- package/docs/docs/cmd/spo/knowledgehub/knowledgehub-set.mdx +1 -1
- package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-add.mdx +1 -1
- package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-list.mdx +1 -1
- package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-remove.mdx +1 -1
- package/docs/docs/cmd/spo/orgnewssite/orgnewssite-list.mdx +1 -1
- package/docs/docs/cmd/spo/orgnewssite/orgnewssite-remove.mdx +1 -1
- package/docs/docs/cmd/spo/orgnewssite/orgnewssite-set.mdx +1 -1
- package/docs/docs/cmd/spo/page/page-remove.mdx +30 -12
- package/docs/docs/cmd/spo/page/page-section-add.mdx +57 -2
- package/docs/docs/cmd/spo/site/site-admin-add.mdx +67 -0
- package/docs/docs/cmd/spo/site/site-admin-list.mdx +64 -12
- package/docs/docs/cmd/spo/site/site-admin-remove.mdx +67 -0
- package/docs/docs/cmd/spo/site/site-appcatalog-add.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-appcatalog-remove.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-commsite-enable.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-list.mdx +6 -4
- package/docs/docs/cmd/spo/site/site-set.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-sharingpermission-set.mdx +58 -0
- package/docs/docs/cmd/spo/sitescript/sitescript-get.mdx +14 -1
- package/docs/docs/cmd/spo/storageentity/storageentity-remove.mdx +1 -1
- package/docs/docs/cmd/spo/storageentity/storageentity-set.mdx +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-appcatalog-add.mdx +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-appcatalogurl-get.mdx +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-list.mdx +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-remove.mdx +1 -1
- package/docs/docs/cmd/spo/tenant/tenant-settings-list.mdx +1 -1
- package/docs/docs/cmd/spo/{site/site-rename.mdx → tenant/tenant-site-rename.mdx} +7 -7
- package/docs/docs/cmd/spo/theme/theme-apply.mdx +1 -1
- package/docs/docs/cmd/spo/theme/theme-get.mdx +1 -1
- package/docs/docs/cmd/spo/theme/theme-list.mdx +1 -1
- package/docs/docs/cmd/spo/theme/theme-remove.mdx +1 -1
- package/docs/docs/cmd/spo/theme/theme-set.mdx +1 -1
- package/docs/docs/cmd/spo/user/user-get.mdx +35 -9
- package/docs/docs/cmd/spp/contentcenter/contentcenter-list.mdx +287 -0
- package/docs/docs/cmd/teams/meeting/meeting-transcript-get.mdx +132 -0
- package/docs/docs/cmd/teams/tab/tab-list.mdx +1 -2
- package/docs/docs/cmd/viva/engage/engage-community-list.mdx +81 -0
- package/npm-shrinkwrap.json +203 -375
- package/package.json +16 -17
- package/dist/m365/cli/commands/cli-reconsent.js +0 -30
- package/docs/docs/cmd/cli/cli-reconsent.mdx +0 -62
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { FN001001_DEP_microsoft_sp_core_library } from './rules/FN001001_DEP_microsoft_sp_core_library.js';
|
|
2
|
+
import { FN001002_DEP_microsoft_sp_lodash_subset } from './rules/FN001002_DEP_microsoft_sp_lodash_subset.js';
|
|
3
|
+
import { FN001003_DEP_microsoft_sp_office_ui_fabric_core } from './rules/FN001003_DEP_microsoft_sp_office_ui_fabric_core.js';
|
|
4
|
+
import { FN001004_DEP_microsoft_sp_webpart_base } from './rules/FN001004_DEP_microsoft_sp_webpart_base.js';
|
|
5
|
+
import { FN001011_DEP_microsoft_sp_dialog } from './rules/FN001011_DEP_microsoft_sp_dialog.js';
|
|
6
|
+
import { FN001012_DEP_microsoft_sp_application_base } from './rules/FN001012_DEP_microsoft_sp_application_base.js';
|
|
7
|
+
import { FN001013_DEP_microsoft_decorators } from './rules/FN001013_DEP_microsoft_decorators.js';
|
|
8
|
+
import { FN001014_DEP_microsoft_sp_listview_extensibility } from './rules/FN001014_DEP_microsoft_sp_listview_extensibility.js';
|
|
9
|
+
import { FN001021_DEP_microsoft_sp_property_pane } from './rules/FN001021_DEP_microsoft_sp_property_pane.js';
|
|
10
|
+
import { FN001023_DEP_microsoft_sp_component_base } from './rules/FN001023_DEP_microsoft_sp_component_base.js';
|
|
11
|
+
import { FN001024_DEP_microsoft_sp_diagnostics } from './rules/FN001024_DEP_microsoft_sp_diagnostics.js';
|
|
12
|
+
import { FN001025_DEP_microsoft_sp_dynamic_data } from './rules/FN001025_DEP_microsoft_sp_dynamic_data.js';
|
|
13
|
+
import { FN001026_DEP_microsoft_sp_extension_base } from './rules/FN001026_DEP_microsoft_sp_extension_base.js';
|
|
14
|
+
import { FN001027_DEP_microsoft_sp_http } from './rules/FN001027_DEP_microsoft_sp_http.js';
|
|
15
|
+
import { FN001028_DEP_microsoft_sp_list_subscription } from './rules/FN001028_DEP_microsoft_sp_list_subscription.js';
|
|
16
|
+
import { FN001029_DEP_microsoft_sp_loader } from './rules/FN001029_DEP_microsoft_sp_loader.js';
|
|
17
|
+
import { FN001030_DEP_microsoft_sp_module_interfaces } from './rules/FN001030_DEP_microsoft_sp_module_interfaces.js';
|
|
18
|
+
import { FN001031_DEP_microsoft_sp_odata_types } from './rules/FN001031_DEP_microsoft_sp_odata_types.js';
|
|
19
|
+
import { FN001032_DEP_microsoft_sp_page_context } from './rules/FN001032_DEP_microsoft_sp_page_context.js';
|
|
20
|
+
import { FN001034_DEP_microsoft_sp_adaptive_card_extension_base } from './rules/FN001034_DEP_microsoft_sp_adaptive_card_extension_base.js';
|
|
21
|
+
import { FN002001_DEVDEP_microsoft_sp_build_web } from './rules/FN002001_DEVDEP_microsoft_sp_build_web.js';
|
|
22
|
+
import { FN002002_DEVDEP_microsoft_sp_module_interfaces } from './rules/FN002002_DEVDEP_microsoft_sp_module_interfaces.js';
|
|
23
|
+
import { FN002021_DEVDEP_rushstack_eslint_config } from './rules/FN002021_DEVDEP_rushstack_eslint_config.js';
|
|
24
|
+
import { FN002022_DEVDEP_microsoft_eslint_plugin_spfx } from './rules/FN002022_DEVDEP_microsoft_eslint_plugin_spfx.js';
|
|
25
|
+
import { FN002023_DEVDEP_microsoft_eslint_config_spfx } from './rules/FN002023_DEVDEP_microsoft_eslint_config_spfx.js';
|
|
26
|
+
import { FN002024_DEVDEP_eslint } from './rules/FN002024_DEVDEP_eslint.js';
|
|
27
|
+
import { FN010001_YORC_version } from './rules/FN010001_YORC_version.js';
|
|
28
|
+
import { FN010010_YORC_sdkVersions_teams_js } from './rules/FN010010_YORC_sdkVersions_teams_js.js';
|
|
29
|
+
export default [
|
|
30
|
+
new FN001001_DEP_microsoft_sp_core_library('1.20.0'),
|
|
31
|
+
new FN001002_DEP_microsoft_sp_lodash_subset('1.20.0'),
|
|
32
|
+
new FN001003_DEP_microsoft_sp_office_ui_fabric_core('1.20.0'),
|
|
33
|
+
new FN001004_DEP_microsoft_sp_webpart_base('1.20.0'),
|
|
34
|
+
new FN001011_DEP_microsoft_sp_dialog('1.20.0'),
|
|
35
|
+
new FN001012_DEP_microsoft_sp_application_base('1.20.0'),
|
|
36
|
+
new FN001014_DEP_microsoft_sp_listview_extensibility('1.20.0'),
|
|
37
|
+
new FN001021_DEP_microsoft_sp_property_pane('1.20.0'),
|
|
38
|
+
new FN001023_DEP_microsoft_sp_component_base('1.20.0'),
|
|
39
|
+
new FN001024_DEP_microsoft_sp_diagnostics('1.20.0'),
|
|
40
|
+
new FN001025_DEP_microsoft_sp_dynamic_data('1.20.0'),
|
|
41
|
+
new FN001026_DEP_microsoft_sp_extension_base('1.20.0'),
|
|
42
|
+
new FN001027_DEP_microsoft_sp_http('1.20.0'),
|
|
43
|
+
new FN001028_DEP_microsoft_sp_list_subscription('1.20.0'),
|
|
44
|
+
new FN001029_DEP_microsoft_sp_loader('1.20.0'),
|
|
45
|
+
new FN001030_DEP_microsoft_sp_module_interfaces('1.20.0'),
|
|
46
|
+
new FN001031_DEP_microsoft_sp_odata_types('1.20.0'),
|
|
47
|
+
new FN001032_DEP_microsoft_sp_page_context('1.20.0'),
|
|
48
|
+
new FN001013_DEP_microsoft_decorators('1.20.0'),
|
|
49
|
+
new FN001034_DEP_microsoft_sp_adaptive_card_extension_base('1.20.0'),
|
|
50
|
+
new FN002001_DEVDEP_microsoft_sp_build_web('1.20.2'),
|
|
51
|
+
new FN002002_DEVDEP_microsoft_sp_module_interfaces('1.20.2'),
|
|
52
|
+
new FN002021_DEVDEP_rushstack_eslint_config('4.0.1'),
|
|
53
|
+
new FN002024_DEVDEP_eslint('8.57.0'),
|
|
54
|
+
new FN002022_DEVDEP_microsoft_eslint_plugin_spfx('1.20.2'),
|
|
55
|
+
new FN002023_DEVDEP_microsoft_eslint_config_spfx('1.20.2'),
|
|
56
|
+
new FN010001_YORC_version('1.20.0'),
|
|
57
|
+
new FN010010_YORC_sdkVersions_teams_js('2.24.0')
|
|
58
|
+
];
|
|
59
|
+
//# sourceMappingURL=upgrade-1.20.0.js.map
|
|
@@ -72,7 +72,8 @@ class SpfxProjectUpgradeCommand extends BaseProjectCommand {
|
|
|
72
72
|
'1.18.0',
|
|
73
73
|
'1.18.1',
|
|
74
74
|
'1.18.2',
|
|
75
|
-
'1.19.0'
|
|
75
|
+
'1.19.0',
|
|
76
|
+
'1.20.0'
|
|
76
77
|
];
|
|
77
78
|
__classPrivateFieldGet(this, _SpfxProjectUpgradeCommand_instances, "m", _SpfxProjectUpgradeCommand_initTelemetry).call(this);
|
|
78
79
|
__classPrivateFieldGet(this, _SpfxProjectUpgradeCommand_instances, "m", _SpfxProjectUpgradeCommand_initOptions).call(this);
|
|
@@ -575,6 +575,21 @@ class SpfxDoctorCommand extends BaseProjectCommand {
|
|
|
575
575
|
range: '^4 || ^5',
|
|
576
576
|
fix: 'npm i -g yo@5'
|
|
577
577
|
}
|
|
578
|
+
},
|
|
579
|
+
'1.20.0': {
|
|
580
|
+
gulpCli: {
|
|
581
|
+
range: '^1 || ^2 || ^3',
|
|
582
|
+
fix: 'npm i -g gulp-cli@3'
|
|
583
|
+
},
|
|
584
|
+
node: {
|
|
585
|
+
range: '>=18.17.1 <19.0.0',
|
|
586
|
+
fix: 'Install Node.js >=18.17.1 <19.0.0'
|
|
587
|
+
},
|
|
588
|
+
sp: SharePointVersion.SPO,
|
|
589
|
+
yo: {
|
|
590
|
+
range: '^4 || ^5',
|
|
591
|
+
fix: 'npm i -g yo@5'
|
|
592
|
+
}
|
|
578
593
|
}
|
|
579
594
|
};
|
|
580
595
|
this.output = '';
|
|
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _SpoAppInStanceListCommand_instances, _SpoAppInStanceListCommand_initOptions, _SpoAppInStanceListCommand_initValidators;
|
|
7
|
-
import
|
|
7
|
+
import { odata } from '../../../../utils/odata.js';
|
|
8
8
|
import { validation } from '../../../../utils/validation.js';
|
|
9
9
|
import commands from '../../commands.js';
|
|
10
10
|
import { SpoAppBaseCommand } from './SpoAppBaseCommand.js';
|
|
@@ -28,24 +28,9 @@ class SpoAppInStanceListCommand extends SpoAppBaseCommand {
|
|
|
28
28
|
if (this.verbose) {
|
|
29
29
|
await logger.logToStderr(`Retrieving installed apps in site at ${args.options.siteUrl}...`);
|
|
30
30
|
}
|
|
31
|
-
const requestOptions = {
|
|
32
|
-
url: `${args.options.siteUrl}/_api/web/AppTiles?$filter=AppType eq 3`,
|
|
33
|
-
method: 'GET',
|
|
34
|
-
headers: {
|
|
35
|
-
'accept': 'application/json;odata=nometadata'
|
|
36
|
-
},
|
|
37
|
-
responseType: 'json'
|
|
38
|
-
};
|
|
39
31
|
try {
|
|
40
|
-
const apps = await
|
|
41
|
-
|
|
42
|
-
await logger.log(apps.value);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
if (this.verbose) {
|
|
46
|
-
await logger.logToStderr('No apps found');
|
|
47
|
-
}
|
|
48
|
-
}
|
|
32
|
+
const apps = await odata.getAllItems(`${args.options.siteUrl}/_api/web/AppTiles?$filter=AppType eq 3`);
|
|
33
|
+
await logger.log(apps);
|
|
49
34
|
}
|
|
50
35
|
catch (err) {
|
|
51
36
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -37,14 +37,7 @@ class SpoAppListCommand extends SpoAppBaseCommand {
|
|
|
37
37
|
await logger.logToStderr(`Retrieving apps...`);
|
|
38
38
|
}
|
|
39
39
|
const apps = await odata.getAllItems(`${appCatalogSiteUrl}/_api/web/${scope}appcatalog/AvailableApps`);
|
|
40
|
-
|
|
41
|
-
await logger.log(apps);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
if (this.verbose) {
|
|
45
|
-
await logger.logToStderr('No apps found');
|
|
46
|
-
}
|
|
47
|
-
}
|
|
40
|
+
await logger.log(apps);
|
|
48
41
|
}
|
|
49
42
|
catch (err) {
|
|
50
43
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -78,15 +78,15 @@ class SpoContentTypeFieldRemoveCommand extends SpoCommand {
|
|
|
78
78
|
const updateChildContentTypes = args.options.listTitle || args.options.listId || args.options.listUrl ? false : args.options.updateChildContentTypes === true;
|
|
79
79
|
if (this.debug) {
|
|
80
80
|
const additionalLog = args.options.listTitle ? `; ListTitle='${args.options.listTitle}'` : args.options.listId ? `; ListId='${args.options.listId}'` : args.options.listUrl ? `; ListUrl='${args.options.listUrl}'` : ` ; UpdateChildContentTypes='${updateChildContentTypes}`;
|
|
81
|
-
await logger.logToStderr(`Remove FieldLink from ContentType.
|
|
81
|
+
await logger.logToStderr(`Remove FieldLink from ContentType. Id='${args.options.id}' ; ContentTypeId='${args.options.contentTypeId}' ${additionalLog}`);
|
|
82
82
|
await logger.logToStderr(`Execute ProcessQuery.`);
|
|
83
83
|
}
|
|
84
84
|
let requestBody = '';
|
|
85
85
|
if (listId) {
|
|
86
|
-
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="18" ObjectPathId="17" /><ObjectPath Id="20" ObjectPathId="19" /><Method Name="DeleteObject" Id="21" ObjectPathId="19" /><Method Name="Update" Id="22" ObjectPathId="15"><Parameters><Parameter Type="Boolean">${updateChildContentTypes}</Parameter></Parameters></Method></Actions><ObjectPaths><Property Id="17" ParentId="15" Name="FieldLinks" /><Method Id="19" ParentId="17" Name="GetById"><Parameters><Parameter Type="Guid">{${formatting.escapeXml(args.options.
|
|
86
|
+
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="18" ObjectPathId="17" /><ObjectPath Id="20" ObjectPathId="19" /><Method Name="DeleteObject" Id="21" ObjectPathId="19" /><Method Name="Update" Id="22" ObjectPathId="15"><Parameters><Parameter Type="Boolean">${updateChildContentTypes}</Parameter></Parameters></Method></Actions><ObjectPaths><Property Id="17" ParentId="15" Name="FieldLinks" /><Method Id="19" ParentId="17" Name="GetById"><Parameters><Parameter Type="Guid">{${formatting.escapeXml(args.options.id)}}</Parameter></Parameters></Method><Identity Id="15" Name="09eec89e-709b-0000-558c-c222dcaf9162|740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:web:${webId}:list:${listId}:contenttype:${formatting.escapeXml(args.options.contentTypeId)}" /></ObjectPaths></Request>`;
|
|
87
87
|
}
|
|
88
88
|
else {
|
|
89
|
-
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.
|
|
89
|
+
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
90
|
}
|
|
91
91
|
requestOptions = {
|
|
92
92
|
url: `${args.options.webUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
@@ -110,7 +110,7 @@ class SpoContentTypeFieldRemoveCommand extends SpoCommand {
|
|
|
110
110
|
await removeFieldLink();
|
|
111
111
|
}
|
|
112
112
|
else {
|
|
113
|
-
const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove the column ${args.options.
|
|
113
|
+
const result = await cli.promptForConfirmation({ message: `Are you sure you want to remove the column ${args.options.id} from content type ${args.options.contentTypeId}?` });
|
|
114
114
|
if (result) {
|
|
115
115
|
await removeFieldLink();
|
|
116
116
|
}
|
|
@@ -160,9 +160,9 @@ _SpoContentTypeFieldRemoveCommand_instances = new WeakSet(), _SpoContentTypeFiel
|
|
|
160
160
|
}, {
|
|
161
161
|
option: '--listUrl [listUrl]'
|
|
162
162
|
}, {
|
|
163
|
-
option: '
|
|
163
|
+
option: '--contentTypeId <contentTypeId>'
|
|
164
164
|
}, {
|
|
165
|
-
option: '--
|
|
165
|
+
option: '-i, --id <id>'
|
|
166
166
|
}, {
|
|
167
167
|
option: '-c, --updateChildContentTypes'
|
|
168
168
|
}, {
|
|
@@ -170,8 +170,8 @@ _SpoContentTypeFieldRemoveCommand_instances = new WeakSet(), _SpoContentTypeFiel
|
|
|
170
170
|
});
|
|
171
171
|
}, _SpoContentTypeFieldRemoveCommand_initValidators = function _SpoContentTypeFieldRemoveCommand_initValidators() {
|
|
172
172
|
this.validators.push(async (args) => {
|
|
173
|
-
if (!validation.isValidGuid(args.options.
|
|
174
|
-
return `${args.options.
|
|
173
|
+
if (!validation.isValidGuid(args.options.id)) {
|
|
174
|
+
return `${args.options.id} is not a valid GUID`;
|
|
175
175
|
}
|
|
176
176
|
if (args.options.listId && !validation.isValidGuid(args.options.listId)) {
|
|
177
177
|
return `${args.options.listId} is not a valid GUID`;
|
|
@@ -262,9 +262,9 @@ _SpoContentTypeFieldSetCommand_instances = new WeakSet(), _SpoContentTypeFieldSe
|
|
|
262
262
|
this.options.unshift({
|
|
263
263
|
option: '-u, --webUrl <webUrl>'
|
|
264
264
|
}, {
|
|
265
|
-
option: '
|
|
265
|
+
option: '--contentTypeId <contentTypeId>'
|
|
266
266
|
}, {
|
|
267
|
-
option: '--id <id>'
|
|
267
|
+
option: '-i, --id <id>'
|
|
268
268
|
}, {
|
|
269
269
|
option: '-r, --required [required]',
|
|
270
270
|
autocomplete: ['true', 'false']
|
|
@@ -26,14 +26,7 @@ class SpoFeatureListCommand extends SpoCommand {
|
|
|
26
26
|
const scope = (args.options.scope) ? args.options.scope : 'Web';
|
|
27
27
|
try {
|
|
28
28
|
const features = await odata.getAllItems(`${args.options.webUrl}/_api/${scope}/Features?$select=DisplayName,DefinitionId`);
|
|
29
|
-
|
|
30
|
-
await logger.log(features);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
if (this.verbose) {
|
|
34
|
-
await logger.logToStderr('No activated Features found');
|
|
35
|
-
}
|
|
36
|
-
}
|
|
29
|
+
await logger.log(features);
|
|
37
30
|
}
|
|
38
31
|
catch (err) {
|
|
39
32
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -27,6 +27,9 @@ class SpoFileCopyCommand extends SpoCommand {
|
|
|
27
27
|
__classPrivateFieldGet(this, _SpoFileCopyCommand_instances, "m", _SpoFileCopyCommand_initOptionSets).call(this);
|
|
28
28
|
__classPrivateFieldGet(this, _SpoFileCopyCommand_instances, "m", _SpoFileCopyCommand_initTypes).call(this);
|
|
29
29
|
}
|
|
30
|
+
getExcludedOptionsWithUrls() {
|
|
31
|
+
return ['targetUrl', 'sourceUrl'];
|
|
32
|
+
}
|
|
30
33
|
async commandAction(logger, args) {
|
|
31
34
|
try {
|
|
32
35
|
const sourceServerRelativePath = await this.getSourcePath(logger, args.options);
|
|
@@ -44,7 +47,8 @@ class SpoFileCopyCommand extends SpoCommand {
|
|
|
44
47
|
nameConflictBehavior: this.getNameConflictBehaviorValue(args.options.nameConflictBehavior),
|
|
45
48
|
bypassSharedLock: !!args.options.bypassSharedLock,
|
|
46
49
|
ignoreVersionHistory: !!args.options.ignoreVersionHistory,
|
|
47
|
-
newName: newName
|
|
50
|
+
newName: newName,
|
|
51
|
+
operation: 'copy'
|
|
48
52
|
});
|
|
49
53
|
if (args.options.skipWait) {
|
|
50
54
|
return;
|
|
@@ -5,6 +5,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
5
5
|
};
|
|
6
6
|
var _SpoFileMoveCommand_instances, _SpoFileMoveCommand_initTelemetry, _SpoFileMoveCommand_initOptions, _SpoFileMoveCommand_initValidators, _SpoFileMoveCommand_initOptionSets, _SpoFileMoveCommand_initTypes;
|
|
7
7
|
import request from '../../../../request.js';
|
|
8
|
+
import { CreateCopyJobsNameConflictBehavior, spo } from '../../../../utils/spo.js';
|
|
8
9
|
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
9
10
|
import { validation } from '../../../../utils/validation.js';
|
|
10
11
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
@@ -31,41 +32,46 @@ class SpoFileMoveCommand extends SpoCommand {
|
|
|
31
32
|
}
|
|
32
33
|
async commandAction(logger, args) {
|
|
33
34
|
try {
|
|
34
|
-
const
|
|
35
|
+
const sourceServerRelativePath = await this.getSourcePath(logger, args.options);
|
|
36
|
+
const sourcePath = this.getAbsoluteUrl(args.options.webUrl, sourceServerRelativePath);
|
|
37
|
+
const destinationPath = this.getAbsoluteUrl(args.options.webUrl, args.options.targetUrl);
|
|
35
38
|
if (this.verbose) {
|
|
36
|
-
await logger.logToStderr(`Moving file ${
|
|
39
|
+
await logger.logToStderr(`Moving file '${sourceServerRelativePath}' to '${args.options.targetUrl}'...`);
|
|
37
40
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (
|
|
41
|
-
|
|
41
|
+
let newName = args.options.newName;
|
|
42
|
+
// Add original file extension if not provided
|
|
43
|
+
if (newName && !newName.includes('.')) {
|
|
44
|
+
newName += sourceServerRelativePath.substring(sourceServerRelativePath.lastIndexOf('.'));
|
|
42
45
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
const copyJobResponse = await spo.createCopyJob(args.options.webUrl, sourcePath, destinationPath, {
|
|
47
|
+
nameConflictBehavior: this.getNameConflictBehaviorValue(args.options.nameConflictBehavior),
|
|
48
|
+
bypassSharedLock: !!args.options.bypassSharedLock,
|
|
49
|
+
includeItemPermissions: !!args.options.includeItemPermissions,
|
|
50
|
+
newName: newName,
|
|
51
|
+
operation: 'move'
|
|
52
|
+
});
|
|
53
|
+
if (args.options.skipWait) {
|
|
54
|
+
return;
|
|
46
55
|
}
|
|
56
|
+
if (this.verbose) {
|
|
57
|
+
await logger.logToStderr('Waiting for the move job to complete...');
|
|
58
|
+
}
|
|
59
|
+
const copyJobResult = await spo.getCopyJobResult(args.options.webUrl, copyJobResponse);
|
|
60
|
+
if (this.verbose) {
|
|
61
|
+
await logger.logToStderr('Getting information about the destination file...');
|
|
62
|
+
}
|
|
63
|
+
// Get destination file data
|
|
64
|
+
const siteRelativeDestinationFolder = '/' + copyJobResult.TargetObjectSiteRelativeUrl.substring(0, copyJobResult.TargetObjectSiteRelativeUrl.lastIndexOf('/'));
|
|
65
|
+
const absoluteWebUrl = destinationPath.substring(0, destinationPath.toLowerCase().lastIndexOf(siteRelativeDestinationFolder.toLowerCase()));
|
|
47
66
|
const requestOptions = {
|
|
48
|
-
url: `${
|
|
67
|
+
url: `${absoluteWebUrl}/_api/Web/GetFileById('${copyJobResult.TargetObjectUniqueId}')`,
|
|
49
68
|
headers: {
|
|
50
69
|
accept: 'application/json;odata=nometadata'
|
|
51
70
|
},
|
|
52
|
-
responseType: 'json'
|
|
53
|
-
data: {
|
|
54
|
-
srcPath: {
|
|
55
|
-
DecodedUrl: absoluteSourcePath
|
|
56
|
-
},
|
|
57
|
-
destPath: {
|
|
58
|
-
DecodedUrl: absoluteTargetPath
|
|
59
|
-
},
|
|
60
|
-
overwrite: args.options.nameConflictBehavior === 'replace',
|
|
61
|
-
options: {
|
|
62
|
-
KeepBoth: args.options.nameConflictBehavior === 'rename',
|
|
63
|
-
ShouldBypassSharedLocks: !!args.options.bypassSharedLock,
|
|
64
|
-
RetainEditorAndModifiedOnMove: !!args.options.retainEditorAndModified
|
|
65
|
-
}
|
|
66
|
-
}
|
|
71
|
+
responseType: 'json'
|
|
67
72
|
};
|
|
68
|
-
await request.
|
|
73
|
+
const destinationFile = await request.get(requestOptions);
|
|
74
|
+
await logger.log(destinationFile);
|
|
69
75
|
}
|
|
70
76
|
catch (err) {
|
|
71
77
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -79,17 +85,30 @@ class SpoFileMoveCommand extends SpoCommand {
|
|
|
79
85
|
await logger.logToStderr(`Retrieving server-relative path for file with ID '${options.sourceId}'...`);
|
|
80
86
|
}
|
|
81
87
|
const requestOptions = {
|
|
82
|
-
url: `${options.webUrl}/_api/Web/GetFileById('${options.sourceId}')
|
|
88
|
+
url: `${options.webUrl}/_api/Web/GetFileById('${options.sourceId}')/ServerRelativePath`,
|
|
83
89
|
headers: {
|
|
84
90
|
accept: 'application/json;odata=nometadata'
|
|
85
91
|
},
|
|
86
92
|
responseType: 'json'
|
|
87
93
|
};
|
|
88
94
|
const file = await request.get(requestOptions);
|
|
89
|
-
return file.
|
|
95
|
+
return file.DecodedUrl;
|
|
96
|
+
}
|
|
97
|
+
getNameConflictBehaviorValue(nameConflictBehavior) {
|
|
98
|
+
switch (nameConflictBehavior?.toLowerCase()) {
|
|
99
|
+
case 'fail':
|
|
100
|
+
return CreateCopyJobsNameConflictBehavior.Fail;
|
|
101
|
+
case 'replace':
|
|
102
|
+
return CreateCopyJobsNameConflictBehavior.Replace;
|
|
103
|
+
case 'rename':
|
|
104
|
+
return CreateCopyJobsNameConflictBehavior.Rename;
|
|
105
|
+
default:
|
|
106
|
+
return CreateCopyJobsNameConflictBehavior.Fail;
|
|
107
|
+
}
|
|
90
108
|
}
|
|
91
109
|
getAbsoluteUrl(webUrl, url) {
|
|
92
|
-
|
|
110
|
+
const result = url.startsWith('https://') ? url : urlUtil.getAbsoluteUrl(webUrl, url);
|
|
111
|
+
return urlUtil.removeTrailingSlashes(result);
|
|
93
112
|
}
|
|
94
113
|
}
|
|
95
114
|
_SpoFileMoveCommand_instances = new WeakSet(), _SpoFileMoveCommand_initTelemetry = function _SpoFileMoveCommand_initTelemetry() {
|
|
@@ -99,8 +118,9 @@ _SpoFileMoveCommand_instances = new WeakSet(), _SpoFileMoveCommand_initTelemetry
|
|
|
99
118
|
sourceId: typeof args.options.sourceId !== 'undefined',
|
|
100
119
|
newName: typeof args.options.newName !== 'undefined',
|
|
101
120
|
nameConflictBehavior: typeof args.options.nameConflictBehavior !== 'undefined',
|
|
102
|
-
|
|
103
|
-
bypassSharedLock: !!args.options.bypassSharedLock
|
|
121
|
+
includeItemPermissions: !!args.options.includeItemPermissions,
|
|
122
|
+
bypassSharedLock: !!args.options.bypassSharedLock,
|
|
123
|
+
skipWait: !!args.options.skipWait
|
|
104
124
|
});
|
|
105
125
|
});
|
|
106
126
|
}, _SpoFileMoveCommand_initOptions = function _SpoFileMoveCommand_initOptions() {
|
|
@@ -118,9 +138,11 @@ _SpoFileMoveCommand_instances = new WeakSet(), _SpoFileMoveCommand_initTelemetry
|
|
|
118
138
|
option: '--nameConflictBehavior [nameConflictBehavior]',
|
|
119
139
|
autocomplete: this.nameConflictBehaviorOptions
|
|
120
140
|
}, {
|
|
121
|
-
option: '--
|
|
141
|
+
option: '--includeItemPermissions'
|
|
122
142
|
}, {
|
|
123
143
|
option: '--bypassSharedLock'
|
|
144
|
+
}, {
|
|
145
|
+
option: '--skipWait'
|
|
124
146
|
});
|
|
125
147
|
}, _SpoFileMoveCommand_initValidators = function _SpoFileMoveCommand_initValidators() {
|
|
126
148
|
this.validators.push(async (args) => {
|
|
@@ -140,7 +162,7 @@ _SpoFileMoveCommand_instances = new WeakSet(), _SpoFileMoveCommand_initTelemetry
|
|
|
140
162
|
this.optionSets.push({ options: ['sourceUrl', 'sourceId'] });
|
|
141
163
|
}, _SpoFileMoveCommand_initTypes = function _SpoFileMoveCommand_initTypes() {
|
|
142
164
|
this.types.string.push('webUrl', 'sourceUrl', 'sourceId', 'targetUrl', 'newName', 'nameConflictBehavior');
|
|
143
|
-
this.types.boolean.push('
|
|
165
|
+
this.types.boolean.push('includeItemPermissions', 'bypassSharedLock', 'skipWait');
|
|
144
166
|
};
|
|
145
167
|
export default new SpoFileMoveCommand();
|
|
146
168
|
//# sourceMappingURL=file-move.js.map
|
|
@@ -4,17 +4,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _SpoFileRoleAssignmentAddCommand_instances, _SpoFileRoleAssignmentAddCommand_initTelemetry, _SpoFileRoleAssignmentAddCommand_initOptions, _SpoFileRoleAssignmentAddCommand_initValidators, _SpoFileRoleAssignmentAddCommand_initOptionSets, _SpoFileRoleAssignmentAddCommand_initTypes;
|
|
7
|
-
import { cli } from '../../../../cli/cli.js';
|
|
8
7
|
import request from '../../../../request.js';
|
|
9
8
|
import { formatting } from '../../../../utils/formatting.js';
|
|
9
|
+
import { spo } from '../../../../utils/spo.js';
|
|
10
10
|
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
11
11
|
import { validation } from '../../../../utils/validation.js';
|
|
12
12
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
13
13
|
import commands from '../../commands.js';
|
|
14
|
-
import spoGroupGetCommand from '../group/group-get.js';
|
|
15
|
-
import spoRoleDefinitionListCommand from '../roledefinition/roledefinition-list.js';
|
|
16
|
-
import spoUserGetCommand from '../user/user-get.js';
|
|
17
|
-
import spoFileGetCommand from './file-get.js';
|
|
18
14
|
class SpoFileRoleAssignmentAddCommand extends SpoCommand {
|
|
19
15
|
get name() {
|
|
20
16
|
return commands.FILE_ROLEASSIGNMENT_ADD;
|
|
@@ -36,14 +32,14 @@ class SpoFileRoleAssignmentAddCommand extends SpoCommand {
|
|
|
36
32
|
await logger.logToStderr(`Adding role assignment to file in site at ${args.options.webUrl}...`);
|
|
37
33
|
}
|
|
38
34
|
try {
|
|
39
|
-
const fileUrl = await this.getFileURL(args);
|
|
40
|
-
const roleDefinitionId = await this.getRoleDefinitionId(args.options);
|
|
35
|
+
const fileUrl = await this.getFileURL(args, logger);
|
|
36
|
+
const roleDefinitionId = await this.getRoleDefinitionId(args.options, logger);
|
|
41
37
|
if (args.options.upn) {
|
|
42
|
-
const upnPrincipalId = await this.getUserPrincipalId(args.options);
|
|
38
|
+
const upnPrincipalId = await this.getUserPrincipalId(args.options, logger);
|
|
43
39
|
await this.addRoleAssignment(fileUrl, args.options.webUrl, upnPrincipalId, roleDefinitionId);
|
|
44
40
|
}
|
|
45
41
|
else if (args.options.groupName) {
|
|
46
|
-
const groupPrincipalId = await this.getGroupPrincipalId(args.options);
|
|
42
|
+
const groupPrincipalId = await this.getGroupPrincipalId(args.options, logger);
|
|
47
43
|
await this.addRoleAssignment(fileUrl, args.options.webUrl, groupPrincipalId, roleDefinitionId);
|
|
48
44
|
}
|
|
49
45
|
else {
|
|
@@ -66,60 +62,27 @@ class SpoFileRoleAssignmentAddCommand extends SpoCommand {
|
|
|
66
62
|
};
|
|
67
63
|
return request.post(requestOptions);
|
|
68
64
|
}
|
|
69
|
-
async getRoleDefinitionId(options) {
|
|
65
|
+
async getRoleDefinitionId(options, logger) {
|
|
70
66
|
if (!options.roleDefinitionName) {
|
|
71
67
|
return options.roleDefinitionId;
|
|
72
68
|
}
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
output: 'json',
|
|
76
|
-
debug: this.debug,
|
|
77
|
-
verbose: this.verbose
|
|
78
|
-
};
|
|
79
|
-
const output = await cli.executeCommandWithOutput(spoRoleDefinitionListCommand, { options: { ...roleDefinitionListCommandOptions, _: [] } });
|
|
80
|
-
const getRoleDefinitionListOutput = JSON.parse(output.stdout);
|
|
81
|
-
const roleDefinitionId = getRoleDefinitionListOutput.find((role) => role.Name === options.roleDefinitionName).Id;
|
|
82
|
-
return roleDefinitionId;
|
|
69
|
+
const roleDefinition = await spo.getRoleDefinitionByName(options.webUrl, options.roleDefinitionName, logger, this.verbose);
|
|
70
|
+
return roleDefinition.Id;
|
|
83
71
|
}
|
|
84
|
-
async getGroupPrincipalId(options) {
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
name: options.groupName,
|
|
88
|
-
output: 'json',
|
|
89
|
-
debug: this.debug,
|
|
90
|
-
verbose: this.verbose
|
|
91
|
-
};
|
|
92
|
-
const output = await cli.executeCommandWithOutput(spoGroupGetCommand, { options: { ...groupGetCommandOptions, _: [] } });
|
|
93
|
-
const getGroupOutput = JSON.parse(output.stdout);
|
|
94
|
-
return getGroupOutput.Id;
|
|
72
|
+
async getGroupPrincipalId(options, logger) {
|
|
73
|
+
const group = await spo.getGroupByName(options.webUrl, options.groupName, logger, this.verbose);
|
|
74
|
+
return group.Id;
|
|
95
75
|
}
|
|
96
|
-
async getUserPrincipalId(options) {
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
email: options.upn,
|
|
100
|
-
id: undefined,
|
|
101
|
-
output: 'json',
|
|
102
|
-
debug: this.debug,
|
|
103
|
-
verbose: this.verbose
|
|
104
|
-
};
|
|
105
|
-
const output = await cli.executeCommandWithOutput(spoUserGetCommand, { options: { ...userGetCommandOptions, _: [] } });
|
|
106
|
-
const getUserOutput = JSON.parse(output.stdout);
|
|
107
|
-
return getUserOutput.Id;
|
|
76
|
+
async getUserPrincipalId(options, logger) {
|
|
77
|
+
const user = await spo.getUserByEmail(options.webUrl, options.upn, logger, this.verbose);
|
|
78
|
+
return user.Id;
|
|
108
79
|
}
|
|
109
|
-
async getFileURL(args) {
|
|
80
|
+
async getFileURL(args, logger) {
|
|
110
81
|
if (args.options.fileUrl) {
|
|
111
82
|
return urlUtil.getServerRelativePath(args.options.webUrl, args.options.fileUrl);
|
|
112
83
|
}
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
id: args.options.fileId,
|
|
116
|
-
output: 'json',
|
|
117
|
-
debug: this.debug,
|
|
118
|
-
verbose: this.verbose
|
|
119
|
-
};
|
|
120
|
-
const output = await cli.executeCommandWithOutput(spoFileGetCommand, { options: { ...options, _: [] } });
|
|
121
|
-
const getFileOutput = JSON.parse(output.stdout);
|
|
122
|
-
return getFileOutput.ServerRelativeUrl;
|
|
84
|
+
const file = await spo.getFileById(args.options.webUrl, args.options.fileId, logger, this.verbose);
|
|
85
|
+
return file.ServerRelativeUrl;
|
|
123
86
|
}
|
|
124
87
|
}
|
|
125
88
|
_SpoFileRoleAssignmentAddCommand_instances = new WeakSet(), _SpoFileRoleAssignmentAddCommand_initTelemetry = function _SpoFileRoleAssignmentAddCommand_initTelemetry() {
|
|
@@ -7,13 +7,11 @@ var _SpoFileRoleAssignmentRemoveCommand_instances, _SpoFileRoleAssignmentRemoveC
|
|
|
7
7
|
import { cli } from '../../../../cli/cli.js';
|
|
8
8
|
import request from '../../../../request.js';
|
|
9
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
10
|
+
import { spo } from '../../../../utils/spo.js';
|
|
10
11
|
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
11
12
|
import { validation } from '../../../../utils/validation.js';
|
|
12
13
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
13
14
|
import commands from '../../commands.js';
|
|
14
|
-
import spoGroupGetCommand from '../group/group-get.js';
|
|
15
|
-
import spoUserGetCommand from '../user/user-get.js';
|
|
16
|
-
import spoFileGetCommand from './file-get.js';
|
|
17
15
|
class SpoFileRoleAssignmentRemoveCommand extends SpoCommand {
|
|
18
16
|
get name() {
|
|
19
17
|
return commands.FILE_ROLEASSIGNMENT_REMOVE;
|
|
@@ -36,13 +34,13 @@ class SpoFileRoleAssignmentRemoveCommand extends SpoCommand {
|
|
|
36
34
|
await logger.logToStderr(`Removing role assignment for ${args.options.groupName || args.options.upn} from file ${args.options.fileUrl || args.options.fileId}`);
|
|
37
35
|
}
|
|
38
36
|
try {
|
|
39
|
-
const fileURL = await this.getFileURL(args);
|
|
37
|
+
const fileURL = await this.getFileURL(args, logger);
|
|
40
38
|
let principalId;
|
|
41
39
|
if (args.options.groupName) {
|
|
42
|
-
principalId = await this.getGroupPrincipalId(args.options);
|
|
40
|
+
principalId = await this.getGroupPrincipalId(args.options, logger);
|
|
43
41
|
}
|
|
44
42
|
else if (args.options.upn) {
|
|
45
|
-
principalId = await this.getUserPrincipalId(args.options);
|
|
43
|
+
principalId = await this.getUserPrincipalId(args.options, logger);
|
|
46
44
|
}
|
|
47
45
|
else {
|
|
48
46
|
principalId = args.options.principalId;
|
|
@@ -71,45 +69,20 @@ class SpoFileRoleAssignmentRemoveCommand extends SpoCommand {
|
|
|
71
69
|
}
|
|
72
70
|
}
|
|
73
71
|
}
|
|
74
|
-
async getFileURL(args) {
|
|
72
|
+
async getFileURL(args, logger) {
|
|
75
73
|
if (args.options.fileUrl) {
|
|
76
74
|
return urlUtil.getServerRelativePath(args.options.webUrl, args.options.fileUrl);
|
|
77
75
|
}
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
id: args.options.fileId,
|
|
81
|
-
output: 'json',
|
|
82
|
-
debug: this.debug,
|
|
83
|
-
verbose: this.verbose
|
|
84
|
-
};
|
|
85
|
-
const output = await cli.executeCommandWithOutput(spoFileGetCommand, { options: { ...options, _: [] } });
|
|
86
|
-
const getFileOutput = JSON.parse(output.stdout);
|
|
87
|
-
return getFileOutput.ServerRelativeUrl;
|
|
76
|
+
const file = await spo.getFileById(args.options.webUrl, args.options.fileId, logger, this.verbose);
|
|
77
|
+
return file.ServerRelativeUrl;
|
|
88
78
|
}
|
|
89
|
-
async getUserPrincipalId(options) {
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
email: options.upn,
|
|
93
|
-
id: undefined,
|
|
94
|
-
output: 'json',
|
|
95
|
-
debug: this.debug,
|
|
96
|
-
verbose: this.verbose
|
|
97
|
-
};
|
|
98
|
-
const output = await cli.executeCommandWithOutput(spoUserGetCommand, { options: { ...userGetCommandOptions, _: [] } });
|
|
99
|
-
const getUserOutput = JSON.parse(output.stdout);
|
|
100
|
-
return getUserOutput.Id;
|
|
79
|
+
async getUserPrincipalId(options, logger) {
|
|
80
|
+
const user = await spo.getUserByEmail(options.webUrl, options.upn, logger, this.verbose);
|
|
81
|
+
return user.Id;
|
|
101
82
|
}
|
|
102
|
-
async getGroupPrincipalId(options) {
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
name: options.groupName,
|
|
106
|
-
output: 'json',
|
|
107
|
-
debug: this.debug,
|
|
108
|
-
verbose: this.verbose
|
|
109
|
-
};
|
|
110
|
-
const output = await cli.executeCommandWithOutput(spoGroupGetCommand, { options: { ...groupGetCommandOptions, _: [] } });
|
|
111
|
-
const getGroupOutput = JSON.parse(output.stdout);
|
|
112
|
-
return getGroupOutput.Id;
|
|
83
|
+
async getGroupPrincipalId(options, logger) {
|
|
84
|
+
const group = await spo.getGroupByName(options.webUrl, options.groupName, logger, this.verbose);
|
|
85
|
+
return group.Id;
|
|
113
86
|
}
|
|
114
87
|
}
|
|
115
88
|
_SpoFileRoleAssignmentRemoveCommand_instances = new WeakSet(), _SpoFileRoleAssignmentRemoveCommand_initTelemetry = function _SpoFileRoleAssignmentRemoveCommand_initTelemetry() {
|