@pnp/cli-microsoft365 7.0.0-beta.9229cf8 → 7.0.0-beta.99e75a7
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.cjs +1 -1
- package/dist/Auth.js +2 -1
- package/dist/Command.js +1 -1
- package/dist/m365/aad/commands/{o365group/o365group-add.js → m365group/m365group-add.js} +17 -17
- package/dist/m365/aad/commands/{o365group/o365group-conversation-list.js → m365group/m365group-conversation-list.js} +10 -10
- package/dist/m365/aad/commands/{o365group/o365group-conversation-post-list.js → m365group/m365group-conversation-post-list.js} +14 -14
- package/dist/m365/aad/commands/{o365group/o365group-get.js → m365group/m365group-get.js} +13 -10
- package/dist/m365/aad/commands/{o365group/o365group-list.js → m365group/m365group-list.js} +13 -28
- package/dist/m365/aad/commands/{o365group/o365group-recyclebinitem-clear.js → m365group/m365group-recyclebinitem-clear.js} +15 -15
- package/dist/m365/aad/commands/{o365group/o365group-recyclebinitem-list.js → m365group/m365group-recyclebinitem-list.js} +10 -10
- package/dist/m365/aad/commands/{o365group/o365group-recyclebinitem-remove.js → m365group/m365group-recyclebinitem-remove.js} +14 -14
- package/dist/m365/aad/commands/{o365group/o365group-recyclebinitem-restore.js → m365group/m365group-recyclebinitem-restore.js} +14 -14
- package/dist/m365/aad/commands/{o365group/o365group-remove.js → m365group/m365group-remove.js} +12 -12
- package/dist/m365/aad/commands/{o365group/o365group-renew.js → m365group/m365group-renew.js} +10 -10
- package/dist/m365/aad/commands/{o365group/o365group-report-activitycounts.js → m365group/m365group-report-activitycounts.js} +4 -4
- package/dist/m365/aad/commands/{o365group/o365group-report-activitydetail.js → m365group/m365group-report-activitydetail.js} +4 -4
- package/dist/m365/aad/commands/{o365group/o365group-report-activityfilecounts.js → m365group/m365group-report-activityfilecounts.js} +4 -4
- package/dist/m365/aad/commands/{o365group/o365group-report-activitygroupcounts.js → m365group/m365group-report-activitygroupcounts.js} +4 -4
- package/dist/m365/aad/commands/{o365group/o365group-report-activitystorage.js → m365group/m365group-report-activitystorage.js} +4 -4
- package/dist/m365/aad/commands/{o365group/o365group-set.js → m365group/m365group-set.js} +17 -17
- package/dist/m365/aad/commands/{o365group/o365group-teamify.js → m365group/m365group-teamify.js} +14 -14
- package/dist/m365/aad/commands/{o365group/o365group-user-add.js → m365group/m365group-user-add.js} +14 -14
- package/dist/m365/aad/commands/{o365group/o365group-user-list.js → m365group/m365group-user-list.js} +12 -12
- package/dist/m365/aad/commands/{o365group/o365group-user-remove.js → m365group/m365group-user-remove.js} +14 -14
- package/dist/m365/aad/commands/{o365group/o365group-user-set.js → m365group/m365group-user-set.js} +15 -15
- package/dist/m365/aad/commands.js +22 -22
- package/dist/m365/pa/commands/app/app-permission-ensure.js +162 -0
- package/dist/m365/pa/commands/app/app-permission-list.js +2 -2
- package/dist/m365/pa/commands/app/app-permission-remove.js +153 -0
- package/dist/m365/pa/commands.js +2 -0
- package/dist/m365/spfx/commands/project/project-externalize/rules/PnPJsRule.js +2 -2
- package/dist/m365/spfx/commands/spfx-doctor.js +73 -103
- package/dist/m365/spo/commands/file/file-add.js +13 -13
- package/dist/m365/spo/commands/file/file-checkin.js +1 -1
- package/dist/m365/spo/commands/file/file-checkout.js +1 -1
- package/dist/m365/spo/commands/file/file-copy.js +36 -4
- package/dist/m365/spo/commands/file/file-list.js +4 -4
- package/dist/m365/spo/commands/file/file-move.js +2 -2
- package/dist/m365/spo/commands/file/file-remove.js +6 -6
- package/dist/m365/spo/commands/file/file-rename.js +2 -2
- package/dist/m365/spo/commands/file/file-retentionlabel-ensure.js +1 -1
- package/dist/m365/spo/commands/file/file-retentionlabel-remove.js +1 -1
- package/dist/m365/spo/commands/file/file-roleassignment-add.js +1 -1
- package/dist/m365/spo/commands/file/file-roleassignment-remove.js +1 -1
- package/dist/m365/spo/commands/file/file-roleinheritance-break.js +1 -1
- package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +1 -1
- package/dist/m365/spo/commands/file/file-version-clear.js +1 -1
- package/dist/m365/spo/commands/file/file-version-get.js +1 -1
- package/dist/m365/spo/commands/file/file-version-list.js +1 -1
- package/dist/m365/spo/commands/file/file-version-remove.js +1 -1
- package/dist/m365/spo/commands/file/file-version-restore.js +1 -1
- package/dist/m365/spo/commands/folder/folder-add.js +2 -4
- package/dist/m365/spo/commands/folder/folder-get.js +1 -1
- package/dist/m365/spo/commands/folder/folder-list.js +2 -2
- package/dist/m365/spo/commands/folder/folder-remove.js +7 -4
- package/dist/m365/spo/commands/folder/folder-rename.js +13 -17
- package/dist/m365/spo/commands/folder/folder-retentionlabel-ensure.js +1 -1
- package/dist/m365/spo/commands/folder/folder-retentionlabel-remove.js +1 -1
- package/dist/m365/spo/commands/folder/folder-roleassignment-add.js +1 -1
- package/dist/m365/spo/commands/folder/folder-roleassignment-remove.js +1 -1
- package/dist/m365/spo/commands/folder/folder-roleinheritance-break.js +1 -1
- package/dist/m365/spo/commands/folder/folder-roleinheritance-reset.js +1 -1
- package/dist/m365/spo/commands/group/group-list.js +0 -1
- package/dist/m365/spo/commands/site/site-set.js +2 -2
- package/dist/m365/spo/commands/theme/theme-list.js +1 -9
- package/dist/utils/spo.js +1 -1
- package/docs/docs/cmd/aad/{o365group/o365group-add.mdx → m365group/m365group-add.mdx} +13 -13
- package/docs/docs/cmd/aad/{o365group/o365group-conversation-list.mdx → m365group/m365group-conversation-list.mdx} +4 -4
- package/docs/docs/cmd/aad/{o365group/o365group-conversation-post-list.mdx → m365group/m365group-conversation-post-list.mdx} +8 -8
- package/docs/docs/cmd/aad/{o365group/o365group-get.mdx → m365group/m365group-get.mdx} +6 -6
- package/docs/docs/cmd/aad/{o365group/o365group-list.mdx → m365group/m365group-list.mdx} +12 -29
- package/docs/docs/cmd/aad/{o365group/o365group-recyclebinitem-clear.mdx → m365group/m365group-recyclebinitem-clear.mdx} +5 -5
- package/docs/docs/cmd/aad/{o365group/o365group-recyclebinitem-list.mdx → m365group/m365group-recyclebinitem-list.mdx} +8 -8
- package/docs/docs/cmd/aad/{o365group/o365group-recyclebinitem-remove.mdx → m365group/m365group-recyclebinitem-remove.mdx} +6 -6
- package/docs/docs/cmd/aad/{o365group/o365group-recyclebinitem-restore.mdx → m365group/m365group-recyclebinitem-restore.mdx} +6 -6
- package/docs/docs/cmd/aad/{o365group/o365group-remove.mdx → m365group/m365group-remove.mdx} +6 -6
- package/docs/docs/cmd/aad/{o365group/o365group-renew.mdx → m365group/m365group-renew.mdx} +4 -4
- package/docs/docs/cmd/aad/{o365group/o365group-report-activitycounts.mdx → m365group/m365group-report-activitycounts.mdx} +6 -6
- package/docs/docs/cmd/aad/{o365group/o365group-report-activitydetail.mdx → m365group/m365group-report-activitydetail.mdx} +7 -7
- package/docs/docs/cmd/aad/{o365group/o365group-report-activityfilecounts.mdx → m365group/m365group-report-activityfilecounts.mdx} +6 -6
- package/docs/docs/cmd/aad/{o365group/o365group-report-activitygroupcounts.mdx → m365group/m365group-report-activitygroupcounts.mdx} +6 -6
- package/docs/docs/cmd/aad/{o365group/o365group-report-activitystorage.mdx → m365group/m365group-report-activitystorage.mdx} +6 -6
- package/docs/docs/cmd/aad/{o365group/o365group-set.mdx → m365group/m365group-set.mdx} +8 -8
- package/docs/docs/cmd/aad/{o365group/o365group-teamify.mdx → m365group/m365group-teamify.mdx} +5 -5
- package/docs/docs/cmd/aad/{o365group/o365group-user-add.mdx → m365group/m365group-user-add.mdx} +5 -5
- package/docs/docs/cmd/aad/{o365group/o365group-user-list.mdx → m365group/m365group-user-list.mdx} +7 -7
- package/docs/docs/cmd/aad/{o365group/o365group-user-remove.mdx → m365group/m365group-user-remove.mdx} +5 -5
- package/docs/docs/cmd/aad/{o365group/o365group-user-set.mdx → m365group/m365group-user-set.mdx} +5 -5
- package/docs/docs/cmd/pa/app/app-permission-ensure.mdx +85 -0
- package/docs/docs/cmd/pa/app/app-permission-remove.mdx +74 -0
- package/docs/docs/cmd/planner/plan/plan-add.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-add.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-checkin.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-checkout-undo.mdx +1 -9
- package/docs/docs/cmd/spo/file/file-checkout.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-copy.mdx +20 -16
- package/docs/docs/cmd/spo/file/file-get.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-list.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-move.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-remove.mdx +8 -8
- package/docs/docs/cmd/spo/file/file-rename.mdx +3 -3
- package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +2 -2
- package/docs/docs/cmd/spo/file/file-retentionlabel-remove.mdx +3 -3
- package/docs/docs/cmd/spo/file/file-roleassignment-add.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-roleassignment-remove.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-roleinheritance-break.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-roleinheritance-reset.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinginfo-get.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-add.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-clear.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-get.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-list.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-remove.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-sharinglink-set.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-clear.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-get.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-list.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-remove.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-version-restore.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-add.mdx +76 -1
- package/docs/docs/cmd/spo/folder/folder-get.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-list.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-remove.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-rename.mdx +5 -1
- package/docs/docs/cmd/spo/folder/folder-retentionlabel-ensure.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-retentionlabel-remove.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-roleassignment-add.mdx +2 -2
- package/docs/docs/cmd/spo/folder/folder-roleassignment-remove.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-roleinheritance-break.mdx +1 -1
- package/docs/docs/cmd/spo/folder/folder-roleinheritance-reset.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-add.mdx +1 -1
- package/docs/docs/cmd/teams/team/team-add.mdx +1 -1
- package/npm-shrinkwrap.json +142 -88
- package/package.json +13 -13
- /package/dist/m365/aad/commands/{o365group → m365group}/GroupExtended.js +0 -0
|
@@ -603,31 +603,21 @@ class SpfxDoctorCommand extends BaseProjectCommand {
|
|
|
603
603
|
this.handleRejectedPromise(err);
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
|
-
checkSharePointCompatibility(spfxVersion, prerequisites, args, fixes, logger) {
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
resolve();
|
|
613
|
-
}
|
|
614
|
-
else {
|
|
615
|
-
await logger.log(formatting.getStatus(CheckStatus.Failure, `Not supported in ${SharePointVersion[sp]}`));
|
|
616
|
-
fixes.push(`Use SharePoint Framework v${(sp === SharePointVersion.SP2016 ? '1.1' : '1.4.1')}`);
|
|
617
|
-
reject(`SharePoint Framework v${spfxVersion} is not supported in ${SharePointVersion[sp]}`);
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
else {
|
|
621
|
-
resolve();
|
|
606
|
+
async checkSharePointCompatibility(spfxVersion, prerequisites, args, fixes, logger) {
|
|
607
|
+
if (args.options.env) {
|
|
608
|
+
const sp = this.spVersionStringToEnum(args.options.env);
|
|
609
|
+
if ((prerequisites.sp & sp) === sp) {
|
|
610
|
+
await logger.log(formatting.getStatus(CheckStatus.Success, `Supported in ${SharePointVersion[sp]}`));
|
|
611
|
+
return;
|
|
622
612
|
}
|
|
623
|
-
|
|
613
|
+
await logger.log(formatting.getStatus(CheckStatus.Failure, `Not supported in ${SharePointVersion[sp]}`));
|
|
614
|
+
fixes.push(`Use SharePoint Framework v${(sp === SharePointVersion.SP2016 ? '1.1' : '1.4.1')}`);
|
|
615
|
+
throw `SharePoint Framework v${spfxVersion} is not supported in ${SharePointVersion[sp]}`;
|
|
616
|
+
}
|
|
624
617
|
}
|
|
625
|
-
checkNodeVersion(prerequisites, fixes, logger) {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
.then((nodeVersion) => {
|
|
629
|
-
this.checkStatus('Node', nodeVersion, prerequisites.node, OptionalOrRequired.Required, fixes, logger);
|
|
630
|
-
});
|
|
618
|
+
async checkNodeVersion(prerequisites, fixes, logger) {
|
|
619
|
+
const nodeVersion = this.getNodeVersion();
|
|
620
|
+
this.checkStatus('Node', nodeVersion, prerequisites.node, OptionalOrRequired.Required, fixes, logger);
|
|
631
621
|
}
|
|
632
622
|
async checkSharePointFrameworkVersion(spfxVersionRequested, fixes, logger) {
|
|
633
623
|
let spfxVersionDetected = await this.getSPFxVersionFromYoRcFile(logger);
|
|
@@ -646,54 +636,42 @@ class SpfxDoctorCommand extends BaseProjectCommand {
|
|
|
646
636
|
fixes.push(versionCheck.fix);
|
|
647
637
|
}
|
|
648
638
|
}
|
|
649
|
-
checkYo(prerequisites, fixes, logger) {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
.
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
fixes.push(prerequisites.yo.fix);
|
|
659
|
-
}
|
|
660
|
-
});
|
|
639
|
+
async checkYo(prerequisites, fixes, logger) {
|
|
640
|
+
const yoVersion = await this.getPackageVersion('yo', PackageSearchMode.GlobalOnly, HandlePromise.Continue, logger);
|
|
641
|
+
if (yoVersion) {
|
|
642
|
+
this.checkStatus('yo', yoVersion, prerequisites.yo, OptionalOrRequired.Required, fixes, logger);
|
|
643
|
+
}
|
|
644
|
+
else {
|
|
645
|
+
await logger.log(formatting.getStatus(CheckStatus.Failure, `yo not found`));
|
|
646
|
+
fixes.push(prerequisites.yo.fix);
|
|
647
|
+
}
|
|
661
648
|
}
|
|
662
|
-
checkGulpCli(prerequisites, fixes, logger) {
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
.
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
fixes.push(prerequisites.gulpCli.fix);
|
|
672
|
-
}
|
|
673
|
-
});
|
|
649
|
+
async checkGulpCli(prerequisites, fixes, logger) {
|
|
650
|
+
const gulpCliVersion = await this.getPackageVersion('gulp-cli', PackageSearchMode.GlobalOnly, HandlePromise.Continue, logger);
|
|
651
|
+
if (gulpCliVersion) {
|
|
652
|
+
this.checkStatus('gulp-cli', gulpCliVersion, prerequisites.gulpCli, OptionalOrRequired.Required, fixes, logger);
|
|
653
|
+
}
|
|
654
|
+
else {
|
|
655
|
+
await logger.log(formatting.getStatus(CheckStatus.Failure, `gulp-cli not found`));
|
|
656
|
+
fixes.push(prerequisites.gulpCli.fix);
|
|
657
|
+
}
|
|
674
658
|
}
|
|
675
|
-
checkGulp(fixes, logger) {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
.
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
fixes.push('npm un -g gulp');
|
|
682
|
-
}
|
|
683
|
-
});
|
|
659
|
+
async checkGulp(fixes, logger) {
|
|
660
|
+
const gulpVersion = await this.getPackageVersion('gulp', PackageSearchMode.GlobalOnly, HandlePromise.Continue, logger);
|
|
661
|
+
if (gulpVersion) {
|
|
662
|
+
await logger.log(formatting.getStatus(CheckStatus.Failure, `gulp should be removed`));
|
|
663
|
+
fixes.push('npm un -g gulp');
|
|
664
|
+
}
|
|
684
665
|
}
|
|
685
|
-
checkTypeScript(fixes, logger) {
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
.
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
await logger.log(formatting.getStatus(CheckStatus.Success, `bundled typescript used`));
|
|
695
|
-
}
|
|
696
|
-
});
|
|
666
|
+
async checkTypeScript(fixes, logger) {
|
|
667
|
+
const typeScriptVersion = await this.getPackageVersion('typescript', PackageSearchMode.LocalOnly, HandlePromise.Continue, logger);
|
|
668
|
+
if (typeScriptVersion) {
|
|
669
|
+
await logger.log(formatting.getStatus(CheckStatus.Failure, `typescript v${typeScriptVersion} installed in the project`));
|
|
670
|
+
fixes.push('npm un typescript');
|
|
671
|
+
}
|
|
672
|
+
else {
|
|
673
|
+
await logger.log(formatting.getStatus(CheckStatus.Success, `bundled typescript used`));
|
|
674
|
+
}
|
|
697
675
|
}
|
|
698
676
|
spVersionStringToEnum(sp) {
|
|
699
677
|
return SharePointVersion[sp.toUpperCase()];
|
|
@@ -742,43 +720,35 @@ class SpfxDoctorCommand extends BaseProjectCommand {
|
|
|
742
720
|
}
|
|
743
721
|
}
|
|
744
722
|
}
|
|
745
|
-
getPackageVersion(packageName, searchMode, handlePromise, logger) {
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
723
|
+
async getPackageVersion(packageName, searchMode, handlePromise, logger) {
|
|
724
|
+
const args = ['ls', packageName, '--depth=0', '--json'];
|
|
725
|
+
if (searchMode === PackageSearchMode.GlobalOnly) {
|
|
726
|
+
args.push('-g');
|
|
727
|
+
}
|
|
728
|
+
let version;
|
|
729
|
+
try {
|
|
730
|
+
version = await this.getPackageVersionFromNpm(args, logger);
|
|
731
|
+
}
|
|
732
|
+
catch {
|
|
733
|
+
if (searchMode === PackageSearchMode.LocalAndGlobal) {
|
|
749
734
|
args.push('-g');
|
|
735
|
+
version = await this.getPackageVersionFromNpm(args, logger);
|
|
750
736
|
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
}
|
|
765
|
-
|
|
766
|
-
if (version) {
|
|
767
|
-
resolve(version);
|
|
768
|
-
}
|
|
769
|
-
else {
|
|
770
|
-
if (handlePromise === HandlePromise.Continue) {
|
|
771
|
-
resolve('');
|
|
772
|
-
}
|
|
773
|
-
else {
|
|
774
|
-
reject();
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
})
|
|
778
|
-
.catch((err) => {
|
|
779
|
-
reject(err);
|
|
780
|
-
});
|
|
781
|
-
});
|
|
737
|
+
else {
|
|
738
|
+
version = '';
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
if (version) {
|
|
742
|
+
return version;
|
|
743
|
+
}
|
|
744
|
+
else {
|
|
745
|
+
if (handlePromise === HandlePromise.Continue) {
|
|
746
|
+
return '';
|
|
747
|
+
}
|
|
748
|
+
else {
|
|
749
|
+
throw new Error();
|
|
750
|
+
}
|
|
751
|
+
}
|
|
782
752
|
}
|
|
783
753
|
getPackageVersionFromNpm(args, logger) {
|
|
784
754
|
return new Promise(async (resolve, reject) => {
|
|
@@ -54,7 +54,7 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
54
54
|
try {
|
|
55
55
|
try {
|
|
56
56
|
const requestOptions = {
|
|
57
|
-
url: `${args.options.webUrl}/_api/web/
|
|
57
|
+
url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(folderPath)}')`,
|
|
58
58
|
headers: {
|
|
59
59
|
'accept': 'application/json;odata=nometadata'
|
|
60
60
|
}
|
|
@@ -88,7 +88,7 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
88
88
|
// initiate chunked upload session
|
|
89
89
|
const uploadId = v4();
|
|
90
90
|
const requestOptions = {
|
|
91
|
-
url: `${args.options.webUrl}/_api/web/
|
|
91
|
+
url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(folderPath)}')/Files/GetByPathOrAddStub(DecodedUrl='${formatting.encodeQueryParameter(fileName)}')/StartUpload(uploadId=guid'${uploadId}')`,
|
|
92
92
|
headers: {
|
|
93
93
|
'accept': 'application/json;odata=nometadata'
|
|
94
94
|
}
|
|
@@ -116,7 +116,7 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
116
116
|
await logger.logToStderr('Cancelling upload session due to error...');
|
|
117
117
|
}
|
|
118
118
|
const requestOptions = {
|
|
119
|
-
url: `${args.options.webUrl}/_api/web/
|
|
119
|
+
url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(folderPath)}')/Files('${formatting.encodeQueryParameter(fileName)}')/cancelupload(uploadId=guid'${uploadId}')`,
|
|
120
120
|
headers: {
|
|
121
121
|
'accept': 'application/json;odata=nometadata'
|
|
122
122
|
}
|
|
@@ -138,7 +138,7 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
138
138
|
const fileBody = fs.readFileSync(fullPath);
|
|
139
139
|
const bodyLength = fileBody.byteLength;
|
|
140
140
|
const requestOptions = {
|
|
141
|
-
url: `${args.options.webUrl}/_api/web/
|
|
141
|
+
url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(folderPath)}')/Files/Add(url='${formatting.encodeQueryParameter(fileName)}', overwrite=true)`,
|
|
142
142
|
data: fileBody,
|
|
143
143
|
headers: {
|
|
144
144
|
'accept': 'application/json;odata=nometadata',
|
|
@@ -180,7 +180,7 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
180
180
|
}
|
|
181
181
|
// approve the existing file with given comment
|
|
182
182
|
const requestOptions = {
|
|
183
|
-
url: `${args.options.webUrl}/_api/web/
|
|
183
|
+
url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(folderPath)}')/Files('${formatting.encodeQueryParameter(fileName)}')/approve(comment='${formatting.encodeQueryParameter(args.options.approveComment || '')}')`,
|
|
184
184
|
headers: {
|
|
185
185
|
'accept': 'application/json;odata=nometadata'
|
|
186
186
|
},
|
|
@@ -197,7 +197,7 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
197
197
|
}
|
|
198
198
|
// publish the existing file with given comment
|
|
199
199
|
const requestOptions = {
|
|
200
|
-
url: `${args.options.webUrl}/_api/web/
|
|
200
|
+
url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(folderPath)}')/Files('${formatting.encodeQueryParameter(fileName)}')/publish(comment='${formatting.encodeQueryParameter(args.options.publishComment || '')}')`,
|
|
201
201
|
headers: {
|
|
202
202
|
'accept': 'application/json;odata=nometadata'
|
|
203
203
|
},
|
|
@@ -211,7 +211,7 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
211
211
|
// in a case the command has done checkout
|
|
212
212
|
// then have to rollback the checkout
|
|
213
213
|
const requestOptions = {
|
|
214
|
-
url: `${args.options.webUrl}/_api/web/
|
|
214
|
+
url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(folderPath)}')/Files('${formatting.encodeQueryParameter(fileName)}')/UndoCheckOut()`
|
|
215
215
|
};
|
|
216
216
|
try {
|
|
217
217
|
await request.post(requestOptions);
|
|
@@ -250,14 +250,14 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
250
250
|
async fileCheckOut(fileName, webUrl, folder) {
|
|
251
251
|
// check if file already exists, otherwise it can't be checked out
|
|
252
252
|
const requestOptionsGetFile = {
|
|
253
|
-
url: `${webUrl}/_api/web/
|
|
253
|
+
url: `${webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(folder)}')/Files('${formatting.encodeQueryParameter(fileName)}')`,
|
|
254
254
|
headers: {
|
|
255
255
|
'accept': 'application/json;odata=nometadata'
|
|
256
256
|
}
|
|
257
257
|
};
|
|
258
258
|
await request.get(requestOptionsGetFile);
|
|
259
259
|
const requestOptionsCheckOut = {
|
|
260
|
-
url: `${webUrl}/_api/web/
|
|
260
|
+
url: `${webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(folder)}')/Files('${formatting.encodeQueryParameter(fileName)}')/CheckOut()`,
|
|
261
261
|
headers: {
|
|
262
262
|
'accept': 'application/json;odata=nometadata'
|
|
263
263
|
},
|
|
@@ -281,7 +281,7 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
281
281
|
fileBuffer = fileBuffer.slice(0, readCount);
|
|
282
282
|
}
|
|
283
283
|
const requestOptions = {
|
|
284
|
-
url: `${info.WebUrl}/_api/web/
|
|
284
|
+
url: `${info.WebUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(info.FolderPath)}')/Files('${formatting.encodeQueryParameter(info.Name)}')/${isLastChunk ? 'Finish' : 'Continue'}Upload(uploadId=guid'${info.Id}',fileOffset=${offset})`,
|
|
285
285
|
data: fileBuffer,
|
|
286
286
|
headers: {
|
|
287
287
|
'accept': 'application/json;odata=nometadata',
|
|
@@ -338,7 +338,7 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
338
338
|
await logger.logToStderr(`Getting list details in order to get its available content types afterwards...`);
|
|
339
339
|
}
|
|
340
340
|
const requestOptions = {
|
|
341
|
-
url: `${webUrl}/_api/web/
|
|
341
|
+
url: `${webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(folder)}')/Files('${formatting.encodeQueryParameter(fileName)}')/ListItemAllFields/ParentList?$Select=Id,EnableModeration,EnableVersioning,EnableMinorVersions`,
|
|
342
342
|
headers: {
|
|
343
343
|
'accept': 'application/json;odata=nometadata'
|
|
344
344
|
},
|
|
@@ -361,7 +361,7 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
361
361
|
}
|
|
362
362
|
// update the existing file list item fields
|
|
363
363
|
const requestOptions = {
|
|
364
|
-
url: `${webUrl}/_api/web/
|
|
364
|
+
url: `${webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(folderPath)}')/Files('${formatting.encodeQueryParameter(fileName)}')/ListItemAllFields/ValidateUpdateListItem()`,
|
|
365
365
|
headers: {
|
|
366
366
|
'accept': 'application/json;odata=nometadata'
|
|
367
367
|
},
|
|
@@ -380,7 +380,7 @@ class SpoFileAddCommand extends SpoCommand {
|
|
|
380
380
|
}
|
|
381
381
|
async fileCheckIn(args, fileName) {
|
|
382
382
|
const requestOptions = {
|
|
383
|
-
url: `${args.options.webUrl}/_api/web/
|
|
383
|
+
url: `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(args.options.folder)}')/Files('${formatting.encodeQueryParameter(fileName)}')/CheckIn(comment='${formatting.encodeQueryParameter(args.options.checkInComment || '')}',checkintype=0)`,
|
|
384
384
|
headers: {
|
|
385
385
|
'accept': 'application/json;odata=nometadata'
|
|
386
386
|
},
|
|
@@ -55,7 +55,7 @@ class SpoFileCheckinCommand extends SpoCommand {
|
|
|
55
55
|
}
|
|
56
56
|
if (args.options.url) {
|
|
57
57
|
const serverRelativePath = urlUtil.getServerRelativePath(args.options.webUrl, args.options.url);
|
|
58
|
-
requestUrl = `${args.options.webUrl}/_api/web/
|
|
58
|
+
requestUrl = `${args.options.webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(serverRelativePath)}')/checkin(comment='${comment}',checkintype=${type})`;
|
|
59
59
|
}
|
|
60
60
|
const requestOptions = {
|
|
61
61
|
url: requestUrl,
|
|
@@ -35,7 +35,7 @@ class SpoFileCheckoutCommand extends SpoCommand {
|
|
|
35
35
|
}
|
|
36
36
|
if (args.options.url) {
|
|
37
37
|
const serverRelativePath = urlUtil.getServerRelativePath(args.options.webUrl, args.options.url);
|
|
38
|
-
requestUrl = `${args.options.webUrl}/_api/web/
|
|
38
|
+
requestUrl = `${args.options.webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(serverRelativePath)}')/checkout`;
|
|
39
39
|
}
|
|
40
40
|
const requestOptions = {
|
|
41
41
|
url: requestUrl,
|
|
@@ -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 _SpoFileCopyCommand_instances, _SpoFileCopyCommand_initTelemetry, _SpoFileCopyCommand_initOptions, _SpoFileCopyCommand_initValidators;
|
|
6
|
+
var _SpoFileCopyCommand_instances, _SpoFileCopyCommand_initTelemetry, _SpoFileCopyCommand_initOptions, _SpoFileCopyCommand_initValidators, _SpoFileCopyCommand_initOptionSets;
|
|
7
7
|
import request from '../../../../request.js';
|
|
8
8
|
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
9
9
|
import { validation } from '../../../../utils/validation.js';
|
|
@@ -23,10 +23,12 @@ class SpoFileCopyCommand extends SpoCommand {
|
|
|
23
23
|
__classPrivateFieldGet(this, _SpoFileCopyCommand_instances, "m", _SpoFileCopyCommand_initTelemetry).call(this);
|
|
24
24
|
__classPrivateFieldGet(this, _SpoFileCopyCommand_instances, "m", _SpoFileCopyCommand_initOptions).call(this);
|
|
25
25
|
__classPrivateFieldGet(this, _SpoFileCopyCommand_instances, "m", _SpoFileCopyCommand_initValidators).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoFileCopyCommand_instances, "m", _SpoFileCopyCommand_initOptionSets).call(this);
|
|
26
27
|
}
|
|
27
28
|
async commandAction(logger, args) {
|
|
28
29
|
try {
|
|
29
|
-
const
|
|
30
|
+
const sourceServerRelativePath = await this.getSourcePath(logger, args.options);
|
|
31
|
+
const sourcePath = this.getAbsoluteUrl(args.options.webUrl, sourceServerRelativePath);
|
|
30
32
|
let destinationPath = this.getAbsoluteUrl(args.options.webUrl, args.options.targetUrl) + '/';
|
|
31
33
|
if (args.options.newName) {
|
|
32
34
|
destinationPath += args.options.newName;
|
|
@@ -54,6 +56,7 @@ class SpoFileCopyCommand extends SpoCommand {
|
|
|
54
56
|
overwrite: args.options.nameConflictBehavior === 'replace',
|
|
55
57
|
options: {
|
|
56
58
|
KeepBoth: args.options.nameConflictBehavior === 'rename',
|
|
59
|
+
ResetAuthorAndCreatedOnCopy: !!args.options.resetAuthorAndCreated,
|
|
57
60
|
ShouldBypassSharedLocks: !!args.options.bypassSharedLock
|
|
58
61
|
}
|
|
59
62
|
}
|
|
@@ -64,6 +67,23 @@ class SpoFileCopyCommand extends SpoCommand {
|
|
|
64
67
|
this.handleRejectedODataJsonPromise(err);
|
|
65
68
|
}
|
|
66
69
|
}
|
|
70
|
+
async getSourcePath(logger, options) {
|
|
71
|
+
if (options.sourceUrl) {
|
|
72
|
+
return urlUtil.getServerRelativePath(options.webUrl, options.sourceUrl);
|
|
73
|
+
}
|
|
74
|
+
if (this.verbose) {
|
|
75
|
+
await logger.logToStderr(`Retrieving server-relative path for file with ID '${options.sourceId}'...`);
|
|
76
|
+
}
|
|
77
|
+
const requestOptions = {
|
|
78
|
+
url: `${options.webUrl}/_api/Web/GetFileById('${options.sourceId}')?$select=ServerRelativePath`,
|
|
79
|
+
headers: {
|
|
80
|
+
accept: 'application/json;odata=nometadata'
|
|
81
|
+
},
|
|
82
|
+
responseType: 'json'
|
|
83
|
+
};
|
|
84
|
+
const file = await request.get(requestOptions);
|
|
85
|
+
return file.ServerRelativePath.DecodedUrl;
|
|
86
|
+
}
|
|
67
87
|
getAbsoluteUrl(webUrl, url) {
|
|
68
88
|
return url.startsWith('https://') ? url : urlUtil.getAbsoluteUrl(webUrl, url);
|
|
69
89
|
}
|
|
@@ -71,8 +91,11 @@ class SpoFileCopyCommand extends SpoCommand {
|
|
|
71
91
|
_SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry = function _SpoFileCopyCommand_initTelemetry() {
|
|
72
92
|
this.telemetry.push((args) => {
|
|
73
93
|
Object.assign(this.telemetryProperties, {
|
|
94
|
+
sourceUrl: typeof args.options.sourceUrl !== 'undefined',
|
|
95
|
+
sourceId: typeof args.options.sourceId !== 'undefined',
|
|
74
96
|
newName: typeof args.options.newName !== 'undefined',
|
|
75
97
|
nameConflictBehavior: args.options.nameConflictBehavior || false,
|
|
98
|
+
resetAuthorAndCreated: !!args.options.resetAuthorAndCreated,
|
|
76
99
|
bypassSharedLock: !!args.options.bypassSharedLock
|
|
77
100
|
});
|
|
78
101
|
});
|
|
@@ -80,7 +103,9 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
|
|
|
80
103
|
this.options.unshift({
|
|
81
104
|
option: '-u, --webUrl <webUrl>'
|
|
82
105
|
}, {
|
|
83
|
-
option: '-s, --sourceUrl
|
|
106
|
+
option: '-s, --sourceUrl [sourceUrl]'
|
|
107
|
+
}, {
|
|
108
|
+
option: '-i, --sourceId [sourceId]'
|
|
84
109
|
}, {
|
|
85
110
|
option: '-t, --targetUrl <targetUrl>'
|
|
86
111
|
}, {
|
|
@@ -88,6 +113,8 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
|
|
|
88
113
|
}, {
|
|
89
114
|
option: '--nameConflictBehavior [nameConflictBehavior]',
|
|
90
115
|
autocomplete: this.nameConflictBehaviorOptions
|
|
116
|
+
}, {
|
|
117
|
+
option: '--resetAuthorAndCreated'
|
|
91
118
|
}, {
|
|
92
119
|
option: '--bypassSharedLock'
|
|
93
120
|
});
|
|
@@ -97,11 +124,16 @@ _SpoFileCopyCommand_instances = new WeakSet(), _SpoFileCopyCommand_initTelemetry
|
|
|
97
124
|
if (isValidSharePointUrl !== true) {
|
|
98
125
|
return isValidSharePointUrl;
|
|
99
126
|
}
|
|
127
|
+
if (args.options.sourceId && !validation.isValidGuid(args.options.sourceId)) {
|
|
128
|
+
return `${args.options.sourceId} is not a valid GUID for sourceId.`;
|
|
129
|
+
}
|
|
100
130
|
if (args.options.nameConflictBehavior && this.nameConflictBehaviorOptions.indexOf(args.options.nameConflictBehavior) === -1) {
|
|
101
|
-
return `${args.options.nameConflictBehavior} is not a valid nameConflictBehavior value. Allowed values: ${this.nameConflictBehaviorOptions.join(', ')}
|
|
131
|
+
return `${args.options.nameConflictBehavior} is not a valid nameConflictBehavior value. Allowed values: ${this.nameConflictBehaviorOptions.join(', ')}.`;
|
|
102
132
|
}
|
|
103
133
|
return true;
|
|
104
134
|
});
|
|
135
|
+
}, _SpoFileCopyCommand_initOptionSets = function _SpoFileCopyCommand_initOptionSets() {
|
|
136
|
+
this.optionSets.push({ options: ['sourceUrl', 'sourceId'] });
|
|
105
137
|
};
|
|
106
138
|
export default new SpoFileCopyCommand();
|
|
107
139
|
//# sourceMappingURL=file-copy.js.map
|
|
@@ -56,7 +56,7 @@ class SpoFileListCommand extends SpoCommand {
|
|
|
56
56
|
}
|
|
57
57
|
const allFiles = [];
|
|
58
58
|
const serverRelativePath = urlUtil.getServerRelativePath(args.options.webUrl, folderUrl);
|
|
59
|
-
const requestUrl = `${args.options.webUrl}/_api/web/
|
|
59
|
+
const requestUrl = `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(serverRelativePath)}')/Files`;
|
|
60
60
|
const queryParams = [`$skip=${skip}`, `$top=${SpoFileListCommand.pageSize}`];
|
|
61
61
|
if (fieldProperties.expandProperties.length > 0) {
|
|
62
62
|
queryParams.push(`$expand=${fieldProperties.expandProperties.join(',')}`);
|
|
@@ -68,7 +68,7 @@ class SpoFileListCommand extends SpoCommand {
|
|
|
68
68
|
queryParams.push(`$filter=${args.options.filter}`);
|
|
69
69
|
}
|
|
70
70
|
const requestOptions = {
|
|
71
|
-
url: `${requestUrl}
|
|
71
|
+
url: `${requestUrl}?${queryParams.join('&')}`,
|
|
72
72
|
method: 'GET',
|
|
73
73
|
headers: {
|
|
74
74
|
'accept': 'application/json;odata=nometadata'
|
|
@@ -90,9 +90,9 @@ class SpoFileListCommand extends SpoCommand {
|
|
|
90
90
|
}
|
|
91
91
|
const allFolders = [];
|
|
92
92
|
const serverRelativeUrl = urlUtil.getServerRelativePath(args.options.webUrl, folderUrl);
|
|
93
|
-
const requestUrl = `${args.options.webUrl}/_api/web/
|
|
93
|
+
const requestUrl = `${args.options.webUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(serverRelativeUrl)}')/Folders`;
|
|
94
94
|
const requestOptions = {
|
|
95
|
-
url: `${requestUrl}
|
|
95
|
+
url: `${requestUrl}?$skip=${skip}&$top=${SpoFileListCommand.pageSize}&$select=ServerRelativeUrl`,
|
|
96
96
|
method: 'GET',
|
|
97
97
|
headers: {
|
|
98
98
|
'accept': 'application/json;odata=nometadata'
|
|
@@ -57,7 +57,7 @@ class SpoFileMoveCommand extends SpoCommand {
|
|
|
57
57
|
const requestOptions = {
|
|
58
58
|
url: requestUrl,
|
|
59
59
|
headers: {
|
|
60
|
-
|
|
60
|
+
accept: 'application/json;odata=nometadata'
|
|
61
61
|
},
|
|
62
62
|
data: {
|
|
63
63
|
exportObjectUris: [sourceAbsoluteUrl],
|
|
@@ -96,7 +96,7 @@ class SpoFileMoveCommand extends SpoCommand {
|
|
|
96
96
|
* Checks if a file exists on the server relative url
|
|
97
97
|
*/
|
|
98
98
|
fileExists(webUrl, sourceUrl) {
|
|
99
|
-
const requestUrl = `${webUrl}/_api/web/
|
|
99
|
+
const requestUrl = `${webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(sourceUrl)}')/`;
|
|
100
100
|
const requestOptions = {
|
|
101
101
|
url: requestUrl,
|
|
102
102
|
method: 'GET',
|
|
@@ -43,7 +43,7 @@ class SpoFileRemoveCommand extends SpoCommand {
|
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
45
|
const serverRelativePath = urlUtil.getServerRelativePath(args.options.webUrl, args.options.url);
|
|
46
|
-
requestUrl = `${args.options.webUrl}/_api/web/
|
|
46
|
+
requestUrl = `${args.options.webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(serverRelativePath)}')`;
|
|
47
47
|
}
|
|
48
48
|
if (args.options.recycle) {
|
|
49
49
|
requestUrl += `/recycle()`;
|
|
@@ -73,7 +73,7 @@ class SpoFileRemoveCommand extends SpoCommand {
|
|
|
73
73
|
type: 'confirm',
|
|
74
74
|
name: 'continue',
|
|
75
75
|
default: false,
|
|
76
|
-
message: `Are you sure you want to ${args.options.recycle ?
|
|
76
|
+
message: `Are you sure you want to ${args.options.recycle ? 'recycle' : 'remove'} the file ${args.options.id || args.options.url} located in site ${args.options.webUrl}?`
|
|
77
77
|
});
|
|
78
78
|
if (result.continue) {
|
|
79
79
|
await removeFile();
|
|
@@ -84,10 +84,10 @@ class SpoFileRemoveCommand extends SpoCommand {
|
|
|
84
84
|
_SpoFileRemoveCommand_instances = new WeakSet(), _SpoFileRemoveCommand_initTelemetry = function _SpoFileRemoveCommand_initTelemetry() {
|
|
85
85
|
this.telemetry.push((args) => {
|
|
86
86
|
Object.assign(this.telemetryProperties, {
|
|
87
|
-
id:
|
|
88
|
-
url:
|
|
89
|
-
recycle:
|
|
90
|
-
force:
|
|
87
|
+
id: typeof args.options.id !== 'undefined',
|
|
88
|
+
url: typeof args.options.url !== 'undefined',
|
|
89
|
+
recycle: !!args.options.recycle,
|
|
90
|
+
force: !!args.options.force
|
|
91
91
|
});
|
|
92
92
|
});
|
|
93
93
|
}, _SpoFileRemoveCommand_initOptions = function _SpoFileRemoveCommand_initOptions() {
|
|
@@ -41,7 +41,7 @@ class SpoFileRenameCommand extends SpoCommand {
|
|
|
41
41
|
}]
|
|
42
42
|
};
|
|
43
43
|
const requestOptions = {
|
|
44
|
-
url: `${webUrl}/_api/web/
|
|
44
|
+
url: `${webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(originalFileServerRelativePath)}')/ListItemAllFields/ValidateUpdateListItem()`,
|
|
45
45
|
headers: {
|
|
46
46
|
'accept': 'application/json;odata=nometadata'
|
|
47
47
|
},
|
|
@@ -56,7 +56,7 @@ class SpoFileRenameCommand extends SpoCommand {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
async getFile(originalFileServerRelativeUrl, webUrl) {
|
|
59
|
-
const requestUrl = `${webUrl}/_api/web/
|
|
59
|
+
const requestUrl = `${webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(originalFileServerRelativeUrl)}')?$select=UniqueId`;
|
|
60
60
|
const requestOptions = {
|
|
61
61
|
url: requestUrl,
|
|
62
62
|
headers: {
|
|
@@ -61,7 +61,7 @@ class SpoFileRetentionLabelEnsureCommand extends SpoCommand {
|
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
63
|
const serverRelativeUrl = urlUtil.getServerRelativePath(args.options.webUrl, args.options.fileUrl);
|
|
64
|
-
requestUrl += `
|
|
64
|
+
requestUrl += `GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(serverRelativeUrl)}')`;
|
|
65
65
|
}
|
|
66
66
|
const requestOptions = {
|
|
67
67
|
url: `${requestUrl}?$expand=ListItemAllFields,ListItemAllFields/ParentList&$select=ServerRelativeUrl,ListItemAllFields/ParentList/Id,ListItemAllFields/Id`,
|
|
@@ -80,7 +80,7 @@ class SpoFileRetentionLabelRemoveCommand extends SpoCommand {
|
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
82
82
|
const serverRelativeUrl = urlUtil.getServerRelativePath(args.options.webUrl, args.options.fileUrl);
|
|
83
|
-
requestUrl += `
|
|
83
|
+
requestUrl += `GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(serverRelativeUrl)}')`;
|
|
84
84
|
}
|
|
85
85
|
requestOptions.url = `${requestUrl}?$expand=ListItemAllFields,ListItemAllFields/ParentList&$select=ListItemAllFields/ParentList/Id,ListItemAllFields/Id`;
|
|
86
86
|
const response = await request.get(requestOptions);
|
|
@@ -55,7 +55,7 @@ class SpoFileRoleAssignmentAddCommand extends SpoCommand {
|
|
|
55
55
|
}
|
|
56
56
|
async addRoleAssignment(fileUrl, webUrl, principalId, roleDefinitionId) {
|
|
57
57
|
const requestOptions = {
|
|
58
|
-
url: `${webUrl}/_api/web/
|
|
58
|
+
url: `${webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(fileUrl)}')/ListItemAllFields/roleassignments/addroleassignment(principalid='${principalId}',roledefid='${roleDefinitionId}')`,
|
|
59
59
|
method: 'POST',
|
|
60
60
|
headers: {
|
|
61
61
|
'accept': 'application/json;odata=nometadata',
|
|
@@ -48,7 +48,7 @@ class SpoFileRoleAssignmentRemoveCommand extends SpoCommand {
|
|
|
48
48
|
}
|
|
49
49
|
const serverRelativePath = urlUtil.getServerRelativePath(args.options.webUrl, fileURL);
|
|
50
50
|
const requestOptions = {
|
|
51
|
-
url: `${args.options.webUrl}/_api/web/
|
|
51
|
+
url: `${args.options.webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(serverRelativePath)}')/ListItemAllFields/roleassignments/removeroleassignment(principalid='${principalId}')`,
|
|
52
52
|
headers: {
|
|
53
53
|
accept: 'application/json;odata=nometadata'
|
|
54
54
|
},
|
|
@@ -36,7 +36,7 @@ class SpoFileRoleInheritanceBreakCommand extends SpoCommand {
|
|
|
36
36
|
const fileURL = await this.getFileURL(args);
|
|
37
37
|
const keepExistingPermissions = !args.options.clearExistingPermissions;
|
|
38
38
|
const requestOptions = {
|
|
39
|
-
url: `${args.options.webUrl}/_api/web/
|
|
39
|
+
url: `${args.options.webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(fileURL)}')/ListItemAllFields/breakroleinheritance(${keepExistingPermissions})`,
|
|
40
40
|
headers: {
|
|
41
41
|
accept: 'application/json;odata=nometadata'
|
|
42
42
|
},
|
|
@@ -35,7 +35,7 @@ class SpoFileRoleInheritanceResetCommand extends SpoCommand {
|
|
|
35
35
|
try {
|
|
36
36
|
const fileURL = await this.getFileURL(args);
|
|
37
37
|
const requestOptions = {
|
|
38
|
-
url: `${args.options.webUrl}/_api/web/
|
|
38
|
+
url: `${args.options.webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(fileURL)}')/ListItemAllFields/resetroleinheritance`,
|
|
39
39
|
headers: {
|
|
40
40
|
accept: 'application/json;odata=nometadata'
|
|
41
41
|
},
|
|
@@ -54,7 +54,7 @@ class SpoFileVersionClearCommand extends SpoCommand {
|
|
|
54
54
|
let requestUrl = `${args.options.webUrl}/_api/web/`;
|
|
55
55
|
if (args.options.fileUrl) {
|
|
56
56
|
const serverRelativePath = urlUtil.getServerRelativePath(args.options.webUrl, args.options.fileUrl);
|
|
57
|
-
requestUrl += `
|
|
57
|
+
requestUrl += `GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(serverRelativePath)}')/versions/DeleteAll()`;
|
|
58
58
|
}
|
|
59
59
|
else {
|
|
60
60
|
requestUrl += `GetFileById('${args.options.fileId}')/versions/DeleteAll()`;
|