@pnp/cli-microsoft365 5.0.0 → 5.1.0-beta.55e5dfb
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/dist/cli/Cli.js +21 -6
- package/dist/m365/aad/commands/app/app-add.js +11 -11
- package/dist/m365/aad/commands/app/app-delete.js +3 -3
- package/dist/m365/aad/commands/app/app-get.js +3 -3
- package/dist/m365/aad/commands/app/app-role-delete.js +2 -2
- package/dist/m365/aad/commands/app/app-role-list.js +6 -5
- package/dist/m365/aad/commands/approleassignment/approleassignment-add.js +4 -4
- package/dist/m365/aad/commands/approleassignment/approleassignment-list.js +3 -3
- package/dist/m365/aad/commands/approleassignment/approleassignment-remove.js +4 -4
- package/dist/m365/aad/commands/group/group-list.js +8 -7
- package/dist/m365/aad/commands/groupsetting/groupsetting-add.js +2 -2
- package/dist/m365/aad/commands/groupsetting/groupsetting-get.js +2 -2
- package/dist/m365/aad/commands/groupsetting/groupsetting-list.js +7 -6
- package/dist/m365/aad/commands/groupsetting/groupsetting-remove.js +2 -2
- package/dist/m365/aad/commands/groupsetting/groupsetting-set.js +2 -2
- package/dist/m365/aad/commands/groupsettingtemplate/groupsettingtemplate-get.js +8 -8
- package/dist/m365/aad/commands/groupsettingtemplate/groupsettingtemplate-list.js +7 -6
- package/dist/m365/aad/commands/o365group/o365group-add.js +2 -2
- package/dist/m365/aad/commands/o365group/o365group-conversation-list.js +8 -8
- package/dist/m365/aad/commands/o365group/o365group-get.js +2 -2
- package/dist/m365/aad/commands/o365group/o365group-list.js +15 -12
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-clear.js +8 -7
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-list.js +7 -6
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-restore.js +2 -2
- package/dist/m365/aad/commands/o365group/o365group-remove.js +2 -2
- package/dist/m365/aad/commands/o365group/o365group-renew.js +2 -2
- package/dist/m365/aad/commands/o365group/o365group-set.js +2 -2
- package/dist/m365/aad/commands/o365group/o365group-teamify.js +2 -2
- package/dist/m365/aad/commands/o365group/o365group-user-add.js +3 -3
- package/dist/m365/aad/commands/o365group/o365group-user-list.js +21 -15
- package/dist/m365/aad/commands/o365group/o365group-user-remove.js +3 -3
- package/dist/m365/aad/commands/o365group/o365group-user-set.js +23 -17
- package/dist/m365/aad/commands/oauth2grant/oauth2grant-add.js +3 -3
- package/dist/m365/aad/commands/oauth2grant/oauth2grant-list.js +2 -2
- package/dist/m365/aad/commands/sp/sp-add.js +3 -3
- package/dist/m365/aad/commands/sp/sp-get.js +3 -3
- package/dist/m365/aad/commands/user/user-get.js +2 -2
- package/dist/m365/aad/commands/user/user-hibp.js +2 -2
- package/dist/m365/aad/commands/user/user-list.js +7 -6
- package/dist/m365/aad/commands/user/user-set.js +2 -2
- package/dist/m365/base/AppCommand.js +2 -2
- package/dist/m365/base/SpoCommand.js +0 -260
- package/dist/m365/cli/commands/cli-doctor.js +2 -2
- package/dist/m365/commands/status.js +3 -3
- package/dist/m365/file/commands/file-add.js +3 -3
- package/dist/m365/file/commands/file-list.js +14 -12
- package/dist/m365/flow/commands/flow-export.js +2 -2
- package/dist/m365/flow/commands/flow-remove.js +2 -2
- package/dist/m365/flow/commands/run/run-cancel.js +2 -2
- package/dist/m365/flow/commands/run/run-resubmit.js +2 -2
- package/dist/m365/graph/commands/schemaextension/schemaextension-add.js +2 -2
- package/dist/m365/graph/commands/schemaextension/schemaextension-list.js +2 -2
- package/dist/m365/graph/commands/schemaextension/schemaextension-set.js +2 -2
- package/dist/m365/graph/commands/subscription/subscription-add.js +2 -2
- package/dist/m365/onedrive/commands/onedrive-list.js +3 -2
- package/dist/m365/outlook/commands/message/message-list.js +6 -5
- package/dist/m365/outlook/commands/room/room-list.js +7 -6
- package/dist/m365/outlook/commands/roomlist/roomlist-list.js +7 -6
- package/dist/m365/pa/commands/app/app-get.js +2 -2
- package/dist/m365/pa/commands/app/app-remove.js +2 -2
- package/dist/m365/pa/commands/pcf/pcf-init.js +4 -4
- package/dist/m365/pa/commands/solution/solution-init.js +2 -2
- package/dist/m365/planner/commands/bucket/bucket-add.js +2 -2
- package/dist/m365/planner/commands/bucket/bucket-list.js +7 -7
- package/dist/m365/planner/commands/plan/plan-add.js +2 -2
- package/dist/m365/planner/commands/plan/plan-details-get.js +134 -0
- package/dist/m365/planner/commands/plan/plan-get.js +7 -7
- package/dist/m365/planner/commands/plan/plan-list.js +2 -2
- package/dist/m365/planner/commands/task/task-add.js +6 -6
- package/dist/m365/planner/commands/task/task-details-get.js +2 -2
- package/dist/m365/planner/commands/task/task-list.js +23 -23
- package/dist/m365/planner/commands/task/task-set.js +6 -6
- package/dist/m365/planner/commands.js +1 -0
- package/dist/m365/spfx/commands/package/package-generate.js +4 -4
- package/dist/m365/spfx/commands/project/base-project-command.js +18 -19
- package/dist/m365/spfx/commands/project/project-upgrade/index.js +0 -1
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001005_DEP_types_react.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001006_DEP_types_react_dom.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001008_DEP_react.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001009_DEP_react_dom.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001015_DEP_types_react_addons_shallow_compare.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001016_DEP_types_react_addons_update.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001017_DEP_types_react_addons_update.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001019_DEP_knockout.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001020_DEP_types_knockout.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN001022_DEP_office_ui_fabric_react.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002015_DEVDEP_types_react.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN002016_DEVDEP_types_react_dom.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN020001_RES_types_react.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN022001_SCSS_remove_fabric_react.js +2 -2
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN022002_SCSS_add_fabric_react.js +2 -2
- package/dist/m365/spo/commands/app/app-add.js +3 -2
- package/dist/m365/spo/commands/app/app-deploy.js +4 -4
- package/dist/m365/spo/commands/app/app-get.js +4 -4
- package/dist/m365/spo/commands/app/app-install.js +3 -3
- package/dist/m365/spo/commands/app/app-instance-list.js +2 -1
- package/dist/m365/spo/commands/app/app-list.js +3 -2
- package/dist/m365/spo/commands/app/app-remove.js +4 -5
- package/dist/m365/spo/commands/app/app-retract.js +4 -5
- package/dist/m365/spo/commands/app/app-uninstall.js +3 -3
- package/dist/m365/spo/commands/app/app-upgrade.js +3 -3
- package/dist/m365/spo/commands/apppage/apppage-add.js +2 -2
- package/dist/m365/spo/commands/apppage/apppage-set.js +2 -2
- package/dist/m365/spo/commands/cdn/cdn-get.js +4 -3
- package/dist/m365/spo/commands/cdn/cdn-origin-add.js +5 -5
- package/dist/m365/spo/commands/cdn/cdn-origin-list.js +4 -3
- package/dist/m365/spo/commands/cdn/cdn-origin-remove.js +5 -5
- package/dist/m365/spo/commands/cdn/cdn-policy-list.js +4 -3
- package/dist/m365/spo/commands/cdn/cdn-policy-set.js +5 -5
- package/dist/m365/spo/commands/cdn/cdn-set.js +3 -2
- package/dist/m365/spo/commands/contenttype/contenttype-add.js +6 -6
- package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +6 -6
- package/dist/m365/spo/commands/contenttype/contenttype-field-set.js +6 -6
- package/dist/m365/spo/commands/contenttype/contenttype-get.js +2 -1
- package/dist/m365/spo/commands/contenttype/contenttype-list.js +2 -1
- package/dist/m365/spo/commands/contenttype/contenttype-remove.js +2 -1
- package/dist/m365/spo/commands/contenttypehub/contenttypehub-get.js +3 -2
- package/dist/m365/spo/commands/customaction/customaction-add.js +3 -3
- package/dist/m365/spo/commands/customaction/customaction-clear.js +2 -1
- package/dist/m365/spo/commands/customaction/customaction-get.js +3 -3
- package/dist/m365/spo/commands/customaction/customaction-list.js +2 -1
- package/dist/m365/spo/commands/customaction/customaction-remove.js +3 -3
- package/dist/m365/spo/commands/customaction/customaction-set.js +4 -4
- package/dist/m365/spo/commands/externaluser/externaluser-list.js +6 -6
- package/dist/m365/spo/commands/feature/feature-enable.js +2 -1
- package/dist/m365/spo/commands/feature/feature-list.js +2 -1
- package/dist/m365/spo/commands/field/field-add.js +3 -2
- package/dist/m365/spo/commands/field/field-get.js +5 -5
- package/dist/m365/spo/commands/field/field-remove.js +5 -5
- package/dist/m365/spo/commands/field/field-set.js +10 -10
- package/dist/m365/spo/commands/file/file-add.js +5 -7
- package/dist/m365/spo/commands/file/file-checkin.js +3 -3
- package/dist/m365/spo/commands/file/file-checkout.js +3 -3
- package/dist/m365/spo/commands/file/file-copy.js +18 -7
- package/dist/m365/spo/commands/file/file-get.js +3 -3
- package/dist/m365/spo/commands/file/file-list.js +3 -3
- package/dist/m365/spo/commands/file/file-move.js +18 -7
- package/dist/m365/spo/commands/file/file-remove.js +3 -3
- package/dist/m365/spo/commands/file/file-sharinginfo-get.js +3 -3
- package/dist/m365/spo/commands/folder/folder-add.js +3 -3
- package/dist/m365/spo/commands/folder/folder-copy.js +16 -5
- package/dist/m365/spo/commands/folder/folder-get.js +3 -3
- package/dist/m365/spo/commands/folder/folder-list.js +3 -3
- package/dist/m365/spo/commands/folder/folder-move.js +16 -5
- package/dist/m365/spo/commands/folder/folder-remove.js +3 -3
- package/dist/m365/spo/commands/folder/folder-rename.js +6 -8
- package/dist/m365/spo/commands/group/group-get.js +2 -1
- package/dist/m365/spo/commands/group/group-list.js +2 -1
- package/dist/m365/spo/commands/group/group-remove.js +2 -1
- package/dist/m365/spo/commands/group/group-user-add.js +2 -1
- package/dist/m365/spo/commands/group/group-user-list.js +2 -1
- package/dist/m365/spo/commands/group/group-user-remove.js +2 -1
- package/dist/m365/spo/commands/hidedefaultthemes/hidedefaultthemes-get.js +2 -1
- package/dist/m365/spo/commands/hidedefaultthemes/hidedefaultthemes-set.js +2 -1
- package/dist/m365/spo/commands/homesite/homesite-get.js +2 -1
- package/dist/m365/spo/commands/homesite/homesite-remove.js +3 -2
- package/dist/m365/spo/commands/homesite/homesite-set.js +5 -5
- package/dist/m365/spo/commands/hubsite/hubsite-connect.js +4 -4
- package/dist/m365/spo/commands/hubsite/hubsite-data-get.js +2 -1
- package/dist/m365/spo/commands/hubsite/hubsite-disconnect.js +3 -2
- package/dist/m365/spo/commands/hubsite/hubsite-get.js +3 -3
- package/dist/m365/spo/commands/hubsite/hubsite-list.js +2 -1
- package/dist/m365/spo/commands/hubsite/hubsite-register.js +3 -2
- package/dist/m365/spo/commands/hubsite/hubsite-rights-grant.js +6 -6
- package/dist/m365/spo/commands/hubsite/hubsite-rights-revoke.js +6 -6
- package/dist/m365/spo/commands/hubsite/hubsite-set.js +8 -8
- package/dist/m365/spo/commands/hubsite/hubsite-theme-sync.js +2 -1
- package/dist/m365/spo/commands/hubsite/hubsite-unregister.js +3 -2
- package/dist/m365/spo/commands/knowledgehub/knowledgehub-get.js +3 -2
- package/dist/m365/spo/commands/knowledgehub/knowledgehub-remove.js +3 -2
- package/dist/m365/spo/commands/knowledgehub/knowledgehub-set.js +5 -5
- package/dist/m365/spo/commands/list/list-add.js +5 -5
- package/dist/m365/spo/commands/list/list-contenttype-add.js +3 -3
- package/dist/m365/spo/commands/list/list-contenttype-default-set.js +3 -3
- package/dist/m365/spo/commands/list/list-contenttype-list.js +3 -3
- package/dist/m365/spo/commands/list/list-contenttype-remove.js +3 -3
- package/dist/m365/spo/commands/list/list-get.js +3 -3
- package/dist/m365/spo/commands/list/list-label-get.js +4 -4
- package/dist/m365/spo/commands/list/list-label-set.js +5 -5
- package/dist/m365/spo/commands/list/list-list.js +2 -1
- package/dist/m365/spo/commands/list/list-remove.js +3 -3
- package/dist/m365/spo/commands/list/list-set.js +6 -6
- package/dist/m365/spo/commands/list/list-sitescript-get.js +4 -4
- package/dist/m365/spo/commands/list/list-view-field-add.js +5 -5
- package/dist/m365/spo/commands/list/list-view-field-remove.js +5 -5
- package/dist/m365/spo/commands/list/list-view-field-set.js +5 -5
- package/dist/m365/spo/commands/list/list-view-get.js +5 -5
- package/dist/m365/spo/commands/list/list-view-list.js +3 -3
- package/dist/m365/spo/commands/list/list-view-remove.js +4 -4
- package/dist/m365/spo/commands/list/list-view-set.js +5 -5
- package/dist/m365/spo/commands/list/list-webhook-add.js +3 -3
- package/dist/m365/spo/commands/list/list-webhook-get.js +4 -4
- package/dist/m365/spo/commands/list/list-webhook-list.js +4 -4
- package/dist/m365/spo/commands/list/list-webhook-remove.js +4 -4
- package/dist/m365/spo/commands/list/list-webhook-set.js +4 -4
- package/dist/m365/spo/commands/listitem/listitem-add.js +5 -7
- package/dist/m365/spo/commands/listitem/listitem-attachment-list.js +3 -3
- package/dist/m365/spo/commands/listitem/listitem-get.js +3 -3
- package/dist/m365/spo/commands/listitem/listitem-isrecord.js +5 -7
- package/dist/m365/spo/commands/listitem/listitem-list.js +4 -4
- package/dist/m365/spo/commands/listitem/listitem-record-declare.js +6 -8
- package/dist/m365/spo/commands/listitem/listitem-record-undeclare.js +5 -7
- package/dist/m365/spo/commands/listitem/listitem-remove.js +3 -3
- package/dist/m365/spo/commands/listitem/listitem-set.js +4 -4
- package/dist/m365/spo/commands/mail/mail-send.js +2 -1
- package/dist/m365/spo/commands/navigation/navigation-node-add.js +2 -1
- package/dist/m365/spo/commands/navigation/navigation-node-list.js +2 -1
- package/dist/m365/spo/commands/navigation/navigation-node-remove.js +3 -2
- package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-add.js +5 -4
- package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-list.js +3 -2
- package/dist/m365/spo/commands/orgassetslibrary/orgassetslibrary-remove.js +3 -2
- package/dist/m365/spo/commands/orgnewssite/orgnewssite-list.js +3 -2
- package/dist/m365/spo/commands/orgnewssite/orgnewssite-remove.js +5 -5
- package/dist/m365/spo/commands/orgnewssite/orgnewssite-set.js +5 -5
- package/dist/m365/spo/commands/page/Page.js +2 -2
- package/dist/m365/spo/commands/page/page-add.js +4 -4
- package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +3 -3
- package/dist/m365/spo/commands/page/page-column-get.js +2 -1
- package/dist/m365/spo/commands/page/page-column-list.js +2 -1
- package/dist/m365/spo/commands/page/page-control-get.js +3 -3
- package/dist/m365/spo/commands/page/page-control-list.js +2 -1
- package/dist/m365/spo/commands/page/page-control-set.js +3 -3
- package/dist/m365/spo/commands/page/page-copy.js +2 -1
- package/dist/m365/spo/commands/page/page-get.js +3 -3
- package/dist/m365/spo/commands/page/page-header-set.js +2 -1
- package/dist/m365/spo/commands/page/page-list.js +2 -1
- package/dist/m365/spo/commands/page/page-remove.js +4 -4
- package/dist/m365/spo/commands/page/page-section-add.js +2 -1
- package/dist/m365/spo/commands/page/page-section-get.js +2 -1
- package/dist/m365/spo/commands/page/page-section-list.js +2 -1
- package/dist/m365/spo/commands/page/page-set.js +4 -4
- package/dist/m365/spo/commands/page/page-template-list.js +2 -1
- package/dist/m365/spo/commands/page/page-text-add.js +4 -4
- package/dist/m365/spo/commands/propertybag/propertybag-base.js +4 -4
- package/dist/m365/spo/commands/propertybag/propertybag-get.js +4 -6
- package/dist/m365/spo/commands/propertybag/propertybag-list.js +4 -6
- package/dist/m365/spo/commands/propertybag/propertybag-remove.js +6 -9
- package/dist/m365/spo/commands/propertybag/propertybag-set.js +8 -10
- package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-grant-add.js +4 -4
- package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-grant-list.js +3 -2
- package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-grant-revoke.js +4 -4
- package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-approve.js +5 -5
- package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-deny.js +5 -5
- package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-permissionrequest-list.js +3 -2
- package/dist/m365/spo/commands/serviceprincipal/serviceprincipal-set.js +3 -2
- package/dist/m365/spo/commands/site/site-add.js +36 -16
- package/dist/m365/spo/commands/site/site-appcatalog-add.js +5 -5
- package/dist/m365/spo/commands/site/site-appcatalog-remove.js +5 -5
- package/dist/m365/spo/commands/site/site-apppermission-add.js +3 -4
- package/dist/m365/spo/commands/site/site-apppermission-get.js +2 -2
- package/dist/m365/spo/commands/site/site-apppermission-list.js +2 -2
- package/dist/m365/spo/commands/site/site-apppermission-remove.js +3 -4
- package/dist/m365/spo/commands/site/site-apppermission-set.js +3 -4
- package/dist/m365/spo/commands/site/site-chrome-set.js +2 -1
- package/dist/m365/spo/commands/site/site-classic-add.js +33 -13
- package/dist/m365/spo/commands/site/site-classic-list.js +4 -4
- package/dist/m365/spo/commands/site/site-classic-set.js +33 -13
- package/dist/m365/spo/commands/site/site-commsite-enable.js +6 -6
- package/dist/m365/spo/commands/site/site-ensure.js +2 -1
- package/dist/m365/spo/commands/site/site-get.js +2 -1
- package/dist/m365/spo/commands/site/site-groupify.js +2 -1
- package/dist/m365/spo/commands/site/site-inplacerecordsmanagement-set.js +3 -3
- package/dist/m365/spo/commands/site/site-list.js +4 -4
- package/dist/m365/spo/commands/site/site-recyclebinitem-list.js +2 -1
- package/dist/m365/spo/commands/site/site-remove.js +34 -14
- package/dist/m365/spo/commands/site/site-rename.js +3 -2
- package/dist/m365/spo/commands/site/site-set.js +12 -12
- package/dist/m365/spo/commands/sitedesign/sitedesign-add.js +4 -4
- package/dist/m365/spo/commands/sitedesign/sitedesign-apply.js +4 -4
- package/dist/m365/spo/commands/sitedesign/sitedesign-get.js +3 -3
- package/dist/m365/spo/commands/sitedesign/sitedesign-list.js +2 -1
- package/dist/m365/spo/commands/sitedesign/sitedesign-remove.js +4 -4
- package/dist/m365/spo/commands/sitedesign/sitedesign-rights-grant.js +4 -4
- package/dist/m365/spo/commands/sitedesign/sitedesign-rights-list.js +4 -4
- package/dist/m365/spo/commands/sitedesign/sitedesign-rights-revoke.js +4 -4
- package/dist/m365/spo/commands/sitedesign/sitedesign-run-list.js +3 -3
- package/dist/m365/spo/commands/sitedesign/sitedesign-run-status-get.js +3 -3
- package/dist/m365/spo/commands/sitedesign/sitedesign-set.js +4 -4
- package/dist/m365/spo/commands/sitedesign/sitedesign-task-get.js +3 -3
- package/dist/m365/spo/commands/sitedesign/sitedesign-task-list.js +2 -1
- package/dist/m365/spo/commands/sitedesign/sitedesign-task-remove.js +3 -3
- package/dist/m365/spo/commands/sitescript/sitescript-add.js +3 -2
- package/dist/m365/spo/commands/sitescript/sitescript-get.js +4 -4
- package/dist/m365/spo/commands/sitescript/sitescript-list.js +3 -2
- package/dist/m365/spo/commands/sitescript/sitescript-remove.js +4 -4
- package/dist/m365/spo/commands/sitescript/sitescript-set.js +4 -4
- package/dist/m365/spo/commands/spo-search.js +4 -4
- package/dist/m365/spo/commands/spo-set.js +2 -1
- package/dist/m365/spo/commands/storageentity/storageentity-get.js +2 -1
- package/dist/m365/spo/commands/storageentity/storageentity-list.js +2 -1
- package/dist/m365/spo/commands/storageentity/storageentity-remove.js +5 -5
- package/dist/m365/spo/commands/storageentity/storageentity-set.js +5 -5
- package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +2 -1
- package/dist/m365/spo/commands/tenant/tenant-appcatalogurl-get.js +2 -1
- package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-list.js +3 -2
- package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-remove.js +16 -6
- package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-restore.js +16 -6
- package/dist/m365/spo/commands/tenant/tenant-settings-list.js +3 -2
- package/dist/m365/spo/commands/tenant/tenant-settings-set.js +5 -5
- package/dist/m365/spo/commands/term/term-add.js +13 -13
- package/dist/m365/spo/commands/term/term-get.js +9 -9
- package/dist/m365/spo/commands/term/term-group-add.js +6 -6
- package/dist/m365/spo/commands/term/term-group-get.js +5 -5
- package/dist/m365/spo/commands/term/term-group-list.js +3 -2
- package/dist/m365/spo/commands/term/term-list.js +7 -7
- package/dist/m365/spo/commands/term/term-set-add.js +9 -9
- package/dist/m365/spo/commands/term/term-set-get.js +7 -7
- package/dist/m365/spo/commands/term/term-set-list.js +5 -5
- package/dist/m365/spo/commands/theme/theme-apply.js +5 -5
- package/dist/m365/spo/commands/theme/theme-get.js +4 -4
- package/dist/m365/spo/commands/theme/theme-list.js +2 -1
- package/dist/m365/spo/commands/theme/theme-remove.js +2 -1
- package/dist/m365/spo/commands/theme/theme-set.js +5 -5
- package/dist/m365/spo/commands/user/user-get.js +2 -1
- package/dist/m365/spo/commands/user/user-list.js +2 -1
- package/dist/m365/spo/commands/user/user-remove.js +2 -1
- package/dist/m365/spo/commands/userprofile/userprofile-get.js +3 -3
- package/dist/m365/spo/commands/userprofile/userprofile-set.js +3 -2
- package/dist/m365/spo/commands/web/web-add.js +4 -3
- package/dist/m365/spo/commands/web/web-clientsidewebpart-list.js +2 -1
- package/dist/m365/spo/commands/web/web-get.js +2 -1
- package/dist/m365/spo/commands/web/web-installedlanguage-list.js +2 -1
- package/dist/m365/spo/commands/web/web-list.js +2 -1
- package/dist/m365/spo/commands/web/web-reindex.js +10 -11
- package/dist/m365/spo/commands/web/web-remove.js +2 -1
- package/dist/m365/spo/commands/web/web-set.js +2 -1
- package/dist/m365/teams/commands/app/app-install.js +4 -4
- package/dist/m365/teams/commands/app/app-list.js +8 -8
- package/dist/m365/teams/commands/app/app-remove.js +2 -2
- package/dist/m365/teams/commands/app/app-uninstall.js +2 -2
- package/dist/m365/teams/commands/app/app-update.js +2 -2
- package/dist/m365/teams/commands/channel/channel-add.js +2 -2
- package/dist/m365/teams/commands/channel/channel-get.js +3 -3
- package/dist/m365/teams/commands/channel/channel-list.js +7 -8
- package/dist/m365/teams/commands/channel/channel-remove.js +3 -3
- package/dist/m365/teams/commands/channel/channel-set.js +2 -2
- package/dist/m365/teams/commands/chat/chat-list.js +7 -6
- package/dist/m365/teams/commands/chat/chat-member-list.js +8 -8
- package/dist/m365/teams/commands/chat/chat-message-list.js +9 -9
- package/dist/m365/teams/commands/chat/chat-message-send.js +4 -4
- package/dist/m365/teams/commands/conversationmember/conversationmember-add.js +3 -3
- package/dist/m365/teams/commands/conversationmember/conversationmember-list.js +9 -9
- package/dist/m365/teams/commands/funsettings/funsettings-list.js +2 -2
- package/dist/m365/teams/commands/funsettings/funsettings-set.js +2 -2
- package/dist/m365/teams/commands/guestsettings/guestsettings-list.js +2 -2
- package/dist/m365/teams/commands/guestsettings/guestsettings-set.js +2 -2
- package/dist/m365/teams/commands/membersettings/membersettings-list.js +2 -2
- package/dist/m365/teams/commands/membersettings/membersettings-set.js +2 -2
- package/dist/m365/teams/commands/message/message-get.js +3 -3
- package/dist/m365/teams/commands/message/message-list.js +12 -12
- package/dist/m365/teams/commands/message/message-reply-list.js +10 -10
- package/dist/m365/teams/commands/messagingsettings/messagingsettings-list.js +2 -2
- package/dist/m365/teams/commands/messagingsettings/messagingsettings-set.js +3 -3
- package/dist/m365/teams/commands/report/report-directroutingcalls.js +3 -3
- package/dist/m365/teams/commands/report/report-pstncalls.js +3 -3
- package/dist/m365/teams/commands/tab/tab-add.js +5 -5
- package/dist/m365/teams/commands/tab/tab-get.js +4 -4
- package/dist/m365/teams/commands/tab/tab-list.js +10 -10
- package/dist/m365/teams/commands/tab/tab-remove.js +4 -4
- package/dist/m365/teams/commands/team/team-archive.js +2 -2
- package/dist/m365/teams/commands/team/team-clone.js +2 -2
- package/dist/m365/teams/commands/team/team-get.js +2 -2
- package/dist/m365/teams/commands/team/team-list.js +10 -12
- package/dist/m365/teams/commands/team/team-remove.js +2 -2
- package/dist/m365/teams/commands/team/team-set.js +2 -2
- package/dist/m365/teams/commands/team/team-unarchive.js +2 -2
- package/dist/m365/teams/commands/user/user-app-add.js +3 -3
- package/dist/m365/teams/commands/user/user-app-list.js +10 -10
- package/dist/m365/teams/commands/user/user-app-remove.js +2 -2
- package/dist/m365/teams/commands/user/user-list.js +14 -8
- package/dist/m365/tenant/commands/auditlog/auditlog-report.js +2 -2
- package/dist/m365/tenant/commands/id/id-get.js +2 -2
- package/dist/m365/tenant/commands/report/report-office365activationcounts.js +2 -2
- package/dist/m365/tenant/commands/report/report-office365activationsusercounts.js +2 -2
- package/dist/m365/tenant/commands/report/report-office365activationsuserdetail.js +2 -2
- package/dist/m365/tenant/commands/service/service-list.js +2 -2
- package/dist/m365/tenant/commands/service/service-message-list.js +2 -2
- package/dist/m365/tenant/commands/service/service-report-historicalservicestatus.js +2 -2
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-list.js +7 -6
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-list.js +7 -6
- package/dist/m365/tenant/commands/status/status-list.js +2 -2
- package/dist/m365/todo/commands/list/list-list.js +7 -6
- package/dist/m365/todo/commands/task/task-list.js +7 -6
- package/dist/request.js +4 -4
- package/dist/settingsNames.js +1 -0
- package/dist/utils/accessToken.js +44 -0
- package/dist/utils/formatting.js +66 -0
- package/dist/utils/fsUtil.js +36 -0
- package/dist/utils/index.js +22 -0
- package/dist/utils/odata.js +37 -0
- package/dist/utils/sinonUtil.js +19 -0
- package/dist/{m365/spfx/commands/project/project-upgrade/Utils.js → utils/spfx.js} +7 -19
- package/dist/utils/spo.js +432 -0
- package/dist/utils/urlUtil.js +174 -0
- package/dist/utils/validation.js +310 -0
- package/docs/docs/cmd/planner/plan/plan-details-get.md +45 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
- package/dist/Utils.js +0 -575
- package/dist/m365/base/AzmgmtResponse.js +0 -3
- package/dist/m365/base/GraphItemsListCommand.js +0 -46
- package/dist/m365/base/GraphResponse.js +0 -3
- package/dist/m365/base/GraphResponseError.js +0 -3
- package/dist/m365/spo/ClientSvc.js +0 -128
- package/dist/m365/spo/FolderExtensions.js +0 -101
- package/dist/m365/spo/commands/site/SpoOperation.js +0 -3
- package/dist/m365/spo/spo.js +0 -3
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.spo = void 0;
|
|
4
|
+
const url = require("url");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
const Auth_1 = require("../Auth");
|
|
7
|
+
const config_1 = require("../config");
|
|
8
|
+
const base_permissions_1 = require("../m365/spo/base-permissions");
|
|
9
|
+
const request_1 = require("../request");
|
|
10
|
+
exports.spo = {
|
|
11
|
+
getRequestDigest(siteUrl) {
|
|
12
|
+
const requestOptions = {
|
|
13
|
+
url: `${siteUrl}/_api/contextinfo`,
|
|
14
|
+
headers: {
|
|
15
|
+
accept: 'application/json;odata=nometadata'
|
|
16
|
+
},
|
|
17
|
+
responseType: 'json'
|
|
18
|
+
};
|
|
19
|
+
return request_1.default.post(requestOptions);
|
|
20
|
+
},
|
|
21
|
+
ensureFormDigest(siteUrl, logger, context, debug) {
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
if (_1.validation.isValidFormDigest(context)) {
|
|
24
|
+
if (debug) {
|
|
25
|
+
logger.logToStderr('Existing form digest still valid');
|
|
26
|
+
}
|
|
27
|
+
resolve(context);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
exports.spo
|
|
31
|
+
.getRequestDigest(siteUrl)
|
|
32
|
+
.then((res) => {
|
|
33
|
+
const now = new Date();
|
|
34
|
+
now.setSeconds(now.getSeconds() + res.FormDigestTimeoutSeconds - 5);
|
|
35
|
+
context = {
|
|
36
|
+
FormDigestValue: res.FormDigestValue,
|
|
37
|
+
FormDigestTimeoutSeconds: res.FormDigestTimeoutSeconds,
|
|
38
|
+
FormDigestExpiresAt: now,
|
|
39
|
+
WebFullUrl: res.WebFullUrl
|
|
40
|
+
};
|
|
41
|
+
resolve(context);
|
|
42
|
+
}, (error) => {
|
|
43
|
+
reject(error);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
waitUntilFinished({ operationId, siteUrl, resolve, reject, logger, currentContext, dots, debug, verbose }) {
|
|
48
|
+
exports.spo
|
|
49
|
+
.ensureFormDigest(siteUrl, logger, currentContext, debug)
|
|
50
|
+
.then((res) => {
|
|
51
|
+
currentContext = res;
|
|
52
|
+
if (debug) {
|
|
53
|
+
logger.logToStderr(`Checking if operation ${operationId} completed...`);
|
|
54
|
+
}
|
|
55
|
+
if (!debug && verbose) {
|
|
56
|
+
dots += '.';
|
|
57
|
+
process.stdout.write(`\r${dots}`);
|
|
58
|
+
}
|
|
59
|
+
const requestOptions = {
|
|
60
|
+
url: `${siteUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
61
|
+
headers: {
|
|
62
|
+
'X-RequestDigest': currentContext.FormDigestValue
|
|
63
|
+
},
|
|
64
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><Query Id="188" ObjectPathId="184"><Query SelectAllProperties="false"><Properties><Property Name="IsComplete" ScalarProperty="true" /><Property Name="PollingInterval" ScalarProperty="true" /></Properties></Query></Query></Actions><ObjectPaths><Identity Id="184" Name="${operationId.replace(/\\n/g, '
').replace(/"/g, '')}" /></ObjectPaths></Request>`
|
|
65
|
+
};
|
|
66
|
+
return request_1.default.post(requestOptions);
|
|
67
|
+
})
|
|
68
|
+
.then((res) => {
|
|
69
|
+
const json = JSON.parse(res);
|
|
70
|
+
const response = json[0];
|
|
71
|
+
if (response.ErrorInfo) {
|
|
72
|
+
reject(response.ErrorInfo.ErrorMessage);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
const operation = json[json.length - 1];
|
|
76
|
+
const isComplete = operation.IsComplete;
|
|
77
|
+
if (isComplete) {
|
|
78
|
+
if (!debug && verbose) {
|
|
79
|
+
process.stdout.write('\n');
|
|
80
|
+
}
|
|
81
|
+
resolve();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
setTimeout(() => {
|
|
85
|
+
exports.spo.waitUntilFinished({
|
|
86
|
+
operationId: JSON.stringify(operation._ObjectIdentity_),
|
|
87
|
+
siteUrl,
|
|
88
|
+
resolve,
|
|
89
|
+
reject,
|
|
90
|
+
logger,
|
|
91
|
+
currentContext,
|
|
92
|
+
dots,
|
|
93
|
+
debug,
|
|
94
|
+
verbose
|
|
95
|
+
});
|
|
96
|
+
}, operation.PollingInterval);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
waitUntilCopyJobFinished({ copyJobInfo, siteUrl, pollingInterval, resolve, reject, logger, dots, debug, verbose }) {
|
|
101
|
+
const requestUrl = `${siteUrl}/_api/site/GetCopyJobProgress`;
|
|
102
|
+
const requestOptions = {
|
|
103
|
+
url: requestUrl,
|
|
104
|
+
headers: {
|
|
105
|
+
'accept': 'application/json;odata=nometadata'
|
|
106
|
+
},
|
|
107
|
+
data: { "copyJobInfo": copyJobInfo },
|
|
108
|
+
responseType: 'json'
|
|
109
|
+
};
|
|
110
|
+
if (!debug && verbose) {
|
|
111
|
+
dots += '.';
|
|
112
|
+
process.stdout.write(`\r${dots}`);
|
|
113
|
+
}
|
|
114
|
+
request_1.default
|
|
115
|
+
.post(requestOptions)
|
|
116
|
+
.then((resp) => {
|
|
117
|
+
if (debug) {
|
|
118
|
+
logger.logToStderr('getCopyJobProgress response...');
|
|
119
|
+
logger.logToStderr(resp);
|
|
120
|
+
}
|
|
121
|
+
for (const item of resp.Logs) {
|
|
122
|
+
const log = JSON.parse(item);
|
|
123
|
+
// reject if progress error
|
|
124
|
+
if (log.Event === "JobError" || log.Event === "JobFatalError") {
|
|
125
|
+
return reject(log.Message);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
// two possible scenarios
|
|
129
|
+
// job done = success promise returned
|
|
130
|
+
// job in progress = recursive call using setTimeout returned
|
|
131
|
+
if (resp.JobState === 0) {
|
|
132
|
+
// job done
|
|
133
|
+
if (verbose) {
|
|
134
|
+
process.stdout.write('\n');
|
|
135
|
+
}
|
|
136
|
+
resolve();
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
setTimeout(() => {
|
|
140
|
+
exports.spo.waitUntilCopyJobFinished({ copyJobInfo, siteUrl, pollingInterval, resolve, reject, logger, dots, debug, verbose });
|
|
141
|
+
}, pollingInterval);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
},
|
|
145
|
+
getSpoUrl(logger, debug) {
|
|
146
|
+
if (Auth_1.default.service.spoUrl) {
|
|
147
|
+
if (debug) {
|
|
148
|
+
logger.logToStderr(`SPO URL previously retrieved ${Auth_1.default.service.spoUrl}. Returning...`);
|
|
149
|
+
}
|
|
150
|
+
return Promise.resolve(Auth_1.default.service.spoUrl);
|
|
151
|
+
}
|
|
152
|
+
return new Promise((resolve, reject) => {
|
|
153
|
+
if (debug) {
|
|
154
|
+
logger.logToStderr(`No SPO URL available. Retrieving from MS Graph...`);
|
|
155
|
+
}
|
|
156
|
+
const requestOptions = {
|
|
157
|
+
url: `https://graph.microsoft.com/v1.0/sites/root?$select=webUrl`,
|
|
158
|
+
headers: {
|
|
159
|
+
'accept': 'application/json;odata.metadata=none'
|
|
160
|
+
},
|
|
161
|
+
responseType: 'json'
|
|
162
|
+
};
|
|
163
|
+
request_1.default
|
|
164
|
+
.get(requestOptions)
|
|
165
|
+
.then((res) => {
|
|
166
|
+
Auth_1.default.service.spoUrl = res.webUrl;
|
|
167
|
+
return Auth_1.default.storeConnectionInfo();
|
|
168
|
+
})
|
|
169
|
+
.then(() => {
|
|
170
|
+
resolve(Auth_1.default.service.spoUrl);
|
|
171
|
+
}, (err) => {
|
|
172
|
+
if (Auth_1.default.service.spoUrl) {
|
|
173
|
+
resolve(Auth_1.default.service.spoUrl);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
reject(err);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
},
|
|
181
|
+
getSpoAdminUrl(logger, debug) {
|
|
182
|
+
return new Promise((resolve, reject) => {
|
|
183
|
+
exports.spo
|
|
184
|
+
.getSpoUrl(logger, debug)
|
|
185
|
+
.then((spoUrl) => {
|
|
186
|
+
resolve(spoUrl.replace(/(https:\/\/)([^\.]+)(.*)/, '$1$2-admin$3'));
|
|
187
|
+
}, (error) => {
|
|
188
|
+
reject(error);
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
},
|
|
192
|
+
getTenantId(logger, debug) {
|
|
193
|
+
if (Auth_1.default.service.tenantId) {
|
|
194
|
+
if (debug) {
|
|
195
|
+
logger.logToStderr(`SPO Tenant ID previously retrieved ${Auth_1.default.service.tenantId}. Returning...`);
|
|
196
|
+
}
|
|
197
|
+
return Promise.resolve(Auth_1.default.service.tenantId);
|
|
198
|
+
}
|
|
199
|
+
return new Promise((resolve, reject) => {
|
|
200
|
+
if (debug) {
|
|
201
|
+
logger.logToStderr(`No SPO Tenant ID available. Retrieving...`);
|
|
202
|
+
}
|
|
203
|
+
let spoAdminUrl = '';
|
|
204
|
+
exports.spo
|
|
205
|
+
.getSpoAdminUrl(logger, debug)
|
|
206
|
+
.then((_spoAdminUrl) => {
|
|
207
|
+
spoAdminUrl = _spoAdminUrl;
|
|
208
|
+
return exports.spo.getRequestDigest(spoAdminUrl);
|
|
209
|
+
})
|
|
210
|
+
.then((contextInfo) => {
|
|
211
|
+
const tenantInfoRequestOptions = {
|
|
212
|
+
url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
213
|
+
headers: {
|
|
214
|
+
'X-RequestDigest': contextInfo.FormDigestValue,
|
|
215
|
+
accept: 'application/json;odata=nometadata'
|
|
216
|
+
},
|
|
217
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="4" ObjectPathId="3" /><Query Id="5" ObjectPathId="3"><Query SelectAllProperties="true"><Properties /></Query></Query></Actions><ObjectPaths><Constructor Id="3" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
|
|
218
|
+
};
|
|
219
|
+
return request_1.default.post(tenantInfoRequestOptions);
|
|
220
|
+
})
|
|
221
|
+
.then((res) => {
|
|
222
|
+
const json = JSON.parse(res);
|
|
223
|
+
Auth_1.default.service.tenantId = json[json.length - 1]._ObjectIdentity_.replace('\n', '
');
|
|
224
|
+
return Auth_1.default.storeConnectionInfo();
|
|
225
|
+
})
|
|
226
|
+
.then(() => {
|
|
227
|
+
resolve(Auth_1.default.service.tenantId);
|
|
228
|
+
}, (err) => {
|
|
229
|
+
if (Auth_1.default.service.tenantId) {
|
|
230
|
+
resolve(Auth_1.default.service.tenantId);
|
|
231
|
+
}
|
|
232
|
+
else {
|
|
233
|
+
reject(err);
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
},
|
|
238
|
+
/**
|
|
239
|
+
* Ensures the folder path exists
|
|
240
|
+
* @param webFullUrl web full url e.g. https://contoso.sharepoint.com/sites/site1
|
|
241
|
+
* @param folderToEnsure web relative or server relative folder path e.g. /Documents/MyFolder or /sites/site1/Documents/MyFolder
|
|
242
|
+
* @param siteAccessToken a valid access token for the site specified in the webFullUrl param
|
|
243
|
+
*/
|
|
244
|
+
ensureFolder(webFullUrl, folderToEnsure, logger, debug) {
|
|
245
|
+
const webUrl = url.parse(webFullUrl);
|
|
246
|
+
if (!webUrl.protocol || !webUrl.hostname) {
|
|
247
|
+
return Promise.reject('webFullUrl is not a valid URL');
|
|
248
|
+
}
|
|
249
|
+
if (!folderToEnsure) {
|
|
250
|
+
return Promise.reject('folderToEnsure cannot be empty');
|
|
251
|
+
}
|
|
252
|
+
// remove last '/' of webFullUrl if exists
|
|
253
|
+
const webFullUrlLastCharPos = webFullUrl.length - 1;
|
|
254
|
+
if (webFullUrl.length > 1 &&
|
|
255
|
+
webFullUrl[webFullUrlLastCharPos] === '/') {
|
|
256
|
+
webFullUrl = webFullUrl.substring(0, webFullUrlLastCharPos);
|
|
257
|
+
}
|
|
258
|
+
folderToEnsure = _1.urlUtil.getWebRelativePath(webFullUrl, folderToEnsure);
|
|
259
|
+
if (debug) {
|
|
260
|
+
logger.log(`folderToEnsure`);
|
|
261
|
+
logger.log(folderToEnsure);
|
|
262
|
+
logger.log('');
|
|
263
|
+
}
|
|
264
|
+
let nextFolder = '';
|
|
265
|
+
let prevFolder = '';
|
|
266
|
+
let folderIndex = 0;
|
|
267
|
+
// build array of folders e.g. ["Shared%20Documents","22","54","55"]
|
|
268
|
+
const folders = folderToEnsure.substring(1).split('/');
|
|
269
|
+
if (debug) {
|
|
270
|
+
logger.log('folders to process');
|
|
271
|
+
logger.log(JSON.stringify(folders));
|
|
272
|
+
logger.log('');
|
|
273
|
+
}
|
|
274
|
+
// recursive function
|
|
275
|
+
const checkOrAddFolder = (resolve, reject) => {
|
|
276
|
+
if (folderIndex === folders.length) {
|
|
277
|
+
if (debug) {
|
|
278
|
+
logger.log(`All sub-folders exist`);
|
|
279
|
+
}
|
|
280
|
+
return resolve();
|
|
281
|
+
}
|
|
282
|
+
// append the next sub-folder to the folder path and check if it exists
|
|
283
|
+
prevFolder = nextFolder;
|
|
284
|
+
nextFolder += `/${folders[folderIndex]}`;
|
|
285
|
+
const folderServerRelativeUrl = _1.urlUtil.getServerRelativePath(webFullUrl, nextFolder);
|
|
286
|
+
const requestOptions = {
|
|
287
|
+
url: `${webFullUrl}/_api/web/GetFolderByServerRelativeUrl('${encodeURIComponent(folderServerRelativeUrl)}')`,
|
|
288
|
+
headers: {
|
|
289
|
+
'accept': 'application/json;odata=nometadata'
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
request_1.default
|
|
293
|
+
.get(requestOptions)
|
|
294
|
+
.then(() => {
|
|
295
|
+
folderIndex++;
|
|
296
|
+
checkOrAddFolder(resolve, reject);
|
|
297
|
+
})
|
|
298
|
+
.catch(() => {
|
|
299
|
+
const prevFolderServerRelativeUrl = _1.urlUtil.getServerRelativePath(webFullUrl, prevFolder);
|
|
300
|
+
const requestOptions = {
|
|
301
|
+
url: `${webFullUrl}/_api/web/GetFolderByServerRelativePath(DecodedUrl=@a1)/AddSubFolderUsingPath(DecodedUrl=@a2)?@a1=%27${encodeURIComponent(prevFolderServerRelativeUrl)}%27&@a2=%27${encodeURIComponent(folders[folderIndex])}%27`,
|
|
302
|
+
headers: {
|
|
303
|
+
'accept': 'application/json;odata=nometadata'
|
|
304
|
+
},
|
|
305
|
+
responseType: 'json'
|
|
306
|
+
};
|
|
307
|
+
return request_1.default.post(requestOptions)
|
|
308
|
+
.then(() => {
|
|
309
|
+
folderIndex++;
|
|
310
|
+
checkOrAddFolder(resolve, reject);
|
|
311
|
+
})
|
|
312
|
+
.catch((err) => {
|
|
313
|
+
if (debug) {
|
|
314
|
+
logger.log(`Could not create sub-folder ${folderServerRelativeUrl}`);
|
|
315
|
+
}
|
|
316
|
+
reject(err);
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
};
|
|
320
|
+
return new Promise(checkOrAddFolder);
|
|
321
|
+
},
|
|
322
|
+
/**
|
|
323
|
+
* Requests web object identity for the current web.
|
|
324
|
+
* That request is something similar to _contextinfo in REST.
|
|
325
|
+
* The response data looks like:
|
|
326
|
+
* _ObjectIdentity_=<GUID>|<GUID>:site:<GUID>:web:<GUID>
|
|
327
|
+
* _ObjectType_=SP.Web
|
|
328
|
+
* ServerRelativeUrl=/sites/contoso
|
|
329
|
+
* @param webUrl web url
|
|
330
|
+
* @param formDigestValue formDigestValue
|
|
331
|
+
*/
|
|
332
|
+
getCurrentWebIdentity(webUrl, formDigestValue) {
|
|
333
|
+
const requestOptions = {
|
|
334
|
+
url: `${webUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
335
|
+
headers: {
|
|
336
|
+
'X-RequestDigest': formDigestValue
|
|
337
|
+
},
|
|
338
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><Query Id="1" ObjectPathId="5"><Query SelectAllProperties="false"><Properties><Property Name="ServerRelativeUrl" ScalarProperty="true" /></Properties></Query></Query></Actions><ObjectPaths><Property Id="5" ParentId="3" Name="Web" /><StaticProperty Id="3" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" /></ObjectPaths></Request>`
|
|
339
|
+
};
|
|
340
|
+
return new Promise((resolve, reject) => {
|
|
341
|
+
request_1.default.post(requestOptions).then((res) => {
|
|
342
|
+
const json = JSON.parse(res);
|
|
343
|
+
const contents = json.find(x => { return x.ErrorInfo; });
|
|
344
|
+
if (contents && contents.ErrorInfo) {
|
|
345
|
+
return reject(contents.ErrorInfo.ErrorMessage || 'ClientSvc unknown error');
|
|
346
|
+
}
|
|
347
|
+
const identityObject = json.find(x => { return x._ObjectIdentity_; });
|
|
348
|
+
if (identityObject) {
|
|
349
|
+
return resolve({
|
|
350
|
+
objectIdentity: identityObject._ObjectIdentity_,
|
|
351
|
+
serverRelativeUrl: identityObject.ServerRelativeUrl
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
reject('Cannot proceed. _ObjectIdentity_ not found'); // this is not supposed to happen
|
|
355
|
+
}, (err) => { reject(err); });
|
|
356
|
+
});
|
|
357
|
+
},
|
|
358
|
+
/**
|
|
359
|
+
* Gets EffectiveBasePermissions for web return type is "_ObjectType_\":\"SP.Web\".
|
|
360
|
+
* @param webObjectIdentity ObjectIdentity. Has format _ObjectIdentity_=<GUID>|<GUID>:site:<GUID>:web:<GUID>
|
|
361
|
+
* @param webUrl web url
|
|
362
|
+
* @param siteAccessToken site access token
|
|
363
|
+
* @param formDigestValue formDigestValue
|
|
364
|
+
*/
|
|
365
|
+
getEffectiveBasePermissions(webObjectIdentity, webUrl, formDigestValue, logger, debug) {
|
|
366
|
+
const basePermissionsResult = new base_permissions_1.BasePermissions();
|
|
367
|
+
const requestOptions = {
|
|
368
|
+
url: `${webUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
369
|
+
headers: {
|
|
370
|
+
'X-RequestDigest': formDigestValue
|
|
371
|
+
},
|
|
372
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><Query Id="11" ObjectPathId="5"><Query SelectAllProperties="false"><Properties><Property Name="EffectiveBasePermissions" ScalarProperty="true" /></Properties></Query></Query></Actions><ObjectPaths><Identity Id="5" Name="${webObjectIdentity}" /></ObjectPaths></Request>`
|
|
373
|
+
};
|
|
374
|
+
return new Promise((resolve, reject) => {
|
|
375
|
+
request_1.default.post(requestOptions).then((res) => {
|
|
376
|
+
if (debug) {
|
|
377
|
+
logger.log('Attempt to get the web EffectiveBasePermissions');
|
|
378
|
+
}
|
|
379
|
+
const json = JSON.parse(res);
|
|
380
|
+
const contents = json.find(x => { return x.ErrorInfo; });
|
|
381
|
+
if (contents && contents.ErrorInfo) {
|
|
382
|
+
return reject(contents.ErrorInfo.ErrorMessage || 'ClientSvc unknown error');
|
|
383
|
+
}
|
|
384
|
+
const permissionsObj = json.find(x => { return x.EffectiveBasePermissions; });
|
|
385
|
+
if (permissionsObj) {
|
|
386
|
+
basePermissionsResult.high = permissionsObj.EffectiveBasePermissions.High;
|
|
387
|
+
basePermissionsResult.low = permissionsObj.EffectiveBasePermissions.Low;
|
|
388
|
+
return resolve(basePermissionsResult);
|
|
389
|
+
}
|
|
390
|
+
reject('Cannot proceed. EffectiveBasePermissions not found'); // this is not supposed to happen
|
|
391
|
+
}, (err) => { reject(err); });
|
|
392
|
+
});
|
|
393
|
+
},
|
|
394
|
+
/**
|
|
395
|
+
* Gets folder by server relative url (GetFolderByServerRelativeUrl in REST)
|
|
396
|
+
* The response data looks like:
|
|
397
|
+
* _ObjectIdentity_=<GUID>|<GUID>:site:<GUID>:web:<GUID>:folder:<GUID>
|
|
398
|
+
* _ObjectType_=SP.Folder
|
|
399
|
+
* @param webObjectIdentity ObjectIdentity. Has format _ObjectIdentity_=<GUID>|<GUID>:site:<GUID>:web:<GUID>
|
|
400
|
+
* @param webUrl web url
|
|
401
|
+
* @param siteRelativeUrl site relative url e.g. /Shared Documents/Folder1
|
|
402
|
+
* @param formDigestValue formDigestValue
|
|
403
|
+
*/
|
|
404
|
+
getFolderIdentity(webObjectIdentity, webUrl, siteRelativeUrl, formDigestValue) {
|
|
405
|
+
const serverRelativePath = _1.urlUtil.getServerRelativePath(webUrl, siteRelativeUrl);
|
|
406
|
+
const requestOptions = {
|
|
407
|
+
url: `${webUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
408
|
+
headers: {
|
|
409
|
+
'X-RequestDigest': formDigestValue
|
|
410
|
+
},
|
|
411
|
+
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="10" ObjectPathId="9" /><ObjectIdentityQuery Id="11" ObjectPathId="9" /><Query Id="12" ObjectPathId="9"><Query SelectAllProperties="false"><Properties><Property Name="Properties" SelectAll="true"><Query SelectAllProperties="false"><Properties /></Query></Property></Properties></Query></Query></Actions><ObjectPaths><Method Id="9" ParentId="5" Name="GetFolderByServerRelativeUrl"><Parameters><Parameter Type="String">${serverRelativePath}</Parameter></Parameters></Method><Identity Id="5" Name="${webObjectIdentity}" /></ObjectPaths></Request>`
|
|
412
|
+
};
|
|
413
|
+
return new Promise((resolve, reject) => {
|
|
414
|
+
return request_1.default.post(requestOptions).then((res) => {
|
|
415
|
+
const json = JSON.parse(res);
|
|
416
|
+
const contents = json.find(x => { return x.ErrorInfo; });
|
|
417
|
+
if (contents && contents.ErrorInfo) {
|
|
418
|
+
return reject(contents.ErrorInfo.ErrorMessage || 'ClientSvc unknown error');
|
|
419
|
+
}
|
|
420
|
+
const objectIdentity = json.find(x => { return x._ObjectIdentity_; });
|
|
421
|
+
if (objectIdentity) {
|
|
422
|
+
return resolve({
|
|
423
|
+
objectIdentity: objectIdentity._ObjectIdentity_,
|
|
424
|
+
serverRelativeUrl: serverRelativePath
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
reject('Cannot proceed. Folder _ObjectIdentity_ not found'); // this is not suppose to happen
|
|
428
|
+
}, (err) => { reject(err); });
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
//# sourceMappingURL=spo.js.map
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.urlUtil = void 0;
|
|
4
|
+
const url = require("url");
|
|
5
|
+
exports.urlUtil = {
|
|
6
|
+
/**
|
|
7
|
+
* Returns server relative path.
|
|
8
|
+
* @param webUrl web full or web relative url e.g. https://contoso.sharepoint.com/sites/team1
|
|
9
|
+
* @param folderRelativePath folder relative path e.g. /Shared Documents
|
|
10
|
+
* @example
|
|
11
|
+
* // returns "/sites/team1"
|
|
12
|
+
* urlUtil.getServerRelativePath("https://contoso.sharepoint.com/sites/team1", "");
|
|
13
|
+
* @example
|
|
14
|
+
* // returns "/sites/team1/Shared Documents"
|
|
15
|
+
* urlUtil.getServerRelativePath("https://contoso.sharepoint.com/sites/team1", "/Shared Documents");
|
|
16
|
+
* @example
|
|
17
|
+
* // returns "/sites/team1/Shared Documents"
|
|
18
|
+
* urlUtil.getServerRelativePath("/sites/team1/", "/Shared Documents");
|
|
19
|
+
*/
|
|
20
|
+
getServerRelativePath(webUrl, folderRelativePath) {
|
|
21
|
+
const tenantUrl = `${url.parse(webUrl).protocol}//${url.parse(webUrl).hostname}`;
|
|
22
|
+
// if webUrl is a server-relative URL then tenantUrl will resolve to null//null
|
|
23
|
+
// in which case we should keep webUrl
|
|
24
|
+
let webRelativePath = tenantUrl !== 'null//null' ? webUrl.substr(tenantUrl.length) : webUrl;
|
|
25
|
+
// will be used to remove relative path from the folderRelativePath
|
|
26
|
+
// in case the web relative url is included
|
|
27
|
+
let relativePathToRemove = webRelativePath;
|
|
28
|
+
// add '/' at 0
|
|
29
|
+
if (webRelativePath[0] !== '/') {
|
|
30
|
+
webRelativePath = `/${webRelativePath}`;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
relativePathToRemove = webRelativePath.substring(1);
|
|
34
|
+
}
|
|
35
|
+
// remove last '/' of webRelativePath
|
|
36
|
+
const webPathLastCharPos = webRelativePath.length - 1;
|
|
37
|
+
if (webRelativePath.length > 1 &&
|
|
38
|
+
webRelativePath[webPathLastCharPos] === '/') {
|
|
39
|
+
webRelativePath = webRelativePath.substring(0, webPathLastCharPos);
|
|
40
|
+
}
|
|
41
|
+
// remove the web relative path if it is contained in the folder relative path
|
|
42
|
+
const relativePathToRemoveIdx = folderRelativePath.toLowerCase().indexOf(relativePathToRemove.toLowerCase());
|
|
43
|
+
if (relativePathToRemoveIdx > -1) {
|
|
44
|
+
const pos = relativePathToRemoveIdx + relativePathToRemove.length;
|
|
45
|
+
folderRelativePath = folderRelativePath.substring(pos, folderRelativePath.length);
|
|
46
|
+
}
|
|
47
|
+
if (folderRelativePath !== '') {
|
|
48
|
+
// add '/' at 0 for siteRelativePath
|
|
49
|
+
if (folderRelativePath[0] !== '/') {
|
|
50
|
+
folderRelativePath = `/${folderRelativePath}`;
|
|
51
|
+
}
|
|
52
|
+
// remove last '/' of siteRelativePath
|
|
53
|
+
const folderPathLastCharPos = folderRelativePath.length - 1;
|
|
54
|
+
if (folderRelativePath[folderPathLastCharPos] === '/') {
|
|
55
|
+
folderRelativePath = folderRelativePath.substring(0, folderPathLastCharPos);
|
|
56
|
+
}
|
|
57
|
+
if (webRelativePath === '/' && folderRelativePath !== '') {
|
|
58
|
+
webRelativePath = folderRelativePath;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
webRelativePath = `${webRelativePath}${folderRelativePath}`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return webRelativePath.replace('//', '/');
|
|
65
|
+
},
|
|
66
|
+
/**
|
|
67
|
+
* Returns server relative site url.
|
|
68
|
+
* @param webUrl web full or web relative url e.g. https://contoso.sharepoint.com/sites/team1
|
|
69
|
+
* @example
|
|
70
|
+
* // returns "/sites/team1"
|
|
71
|
+
* urlUtil.getServerRelativeSiteUrl("https://contoso.sharepoint.com/sites/team1";
|
|
72
|
+
* @example
|
|
73
|
+
* // returns ""
|
|
74
|
+
* urlUtil.getServerRelativeSiteUrl("https://contoso.sharepoint.com");
|
|
75
|
+
* @example
|
|
76
|
+
* // returns "/sites/team1/Shared Documents"
|
|
77
|
+
* urlUtil.getServerRelativePath("/sites/team1/", "/Shared Documents");
|
|
78
|
+
*/
|
|
79
|
+
getServerRelativeSiteUrl(webUrl) {
|
|
80
|
+
const serverRelativeSiteUrl = exports.urlUtil.getServerRelativePath(webUrl, '');
|
|
81
|
+
// return an empty string instead of / to prevent // replies
|
|
82
|
+
return serverRelativeSiteUrl === '/' ? "" : serverRelativeSiteUrl;
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* Returns web relative path from webUrl and folderUrl.
|
|
86
|
+
* @param webUrl web full or web relative url e.g. https://contoso.sharepoint.com/sites/team1/
|
|
87
|
+
* @param folderUrl folder server relative url e.g. /sites/team1/Lists/MyList
|
|
88
|
+
* @example
|
|
89
|
+
* // returns "/Lists/MyList"
|
|
90
|
+
* Utils.getWebRelativePath("https://contoso.sharepoint.com/sites/team1/", "/sites/team1/Lists/MyList");
|
|
91
|
+
* @example
|
|
92
|
+
* // returns "/Shared Documents"
|
|
93
|
+
* Utils.getWebRelativePath("/sites/team1/", "/sites/team1/Shared Documents");
|
|
94
|
+
*/
|
|
95
|
+
getWebRelativePath(webUrl, folderUrl) {
|
|
96
|
+
let folderWebRelativePath = '';
|
|
97
|
+
const tenantUrl = `${url.parse(webUrl).protocol}//${url.parse(webUrl).hostname}`;
|
|
98
|
+
// if webUrl is a server-relative URL then tenantUrl will resolve to null//null
|
|
99
|
+
// in which case we should keep webUrl
|
|
100
|
+
let webRelativePath = tenantUrl !== 'null//null' ? webUrl.substr(tenantUrl.length) : webUrl;
|
|
101
|
+
// will be used to remove relative path from the folderRelativePath
|
|
102
|
+
// in case the web relative url is included
|
|
103
|
+
let relativePathToRemove = webRelativePath;
|
|
104
|
+
// add '/' at 0
|
|
105
|
+
if (webRelativePath[0] !== '/') {
|
|
106
|
+
webRelativePath = `/${webRelativePath}`;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
relativePathToRemove = webRelativePath.substring(1);
|
|
110
|
+
}
|
|
111
|
+
// remove last '/' of webRelativePath
|
|
112
|
+
const webPathLastCharPos = webRelativePath.length - 1;
|
|
113
|
+
if (webRelativePath.length > 1 &&
|
|
114
|
+
webRelativePath[webPathLastCharPos] === '/') {
|
|
115
|
+
webRelativePath = webRelativePath.substring(0, webPathLastCharPos);
|
|
116
|
+
}
|
|
117
|
+
// remove the web relative path if it is contained in the folder relative path
|
|
118
|
+
const relativePathToRemoveIdx = folderUrl.toLowerCase().indexOf(relativePathToRemove.toLowerCase());
|
|
119
|
+
if (relativePathToRemoveIdx > -1) {
|
|
120
|
+
const pos = relativePathToRemoveIdx + relativePathToRemove.length;
|
|
121
|
+
folderWebRelativePath = folderUrl.substring(pos, folderUrl.length);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
folderWebRelativePath = folderUrl;
|
|
125
|
+
}
|
|
126
|
+
// add '/' at 0 for folderWebRelativePath
|
|
127
|
+
if (folderWebRelativePath[0] !== '/') {
|
|
128
|
+
folderWebRelativePath = `/${folderWebRelativePath}`;
|
|
129
|
+
}
|
|
130
|
+
// remove last '/' of folderWebRelativePath
|
|
131
|
+
const folderPathLastCharPos = folderWebRelativePath.length - 1;
|
|
132
|
+
if (folderWebRelativePath.length > 1 && folderWebRelativePath[folderPathLastCharPos] === '/') {
|
|
133
|
+
folderWebRelativePath = folderWebRelativePath.substring(0, folderPathLastCharPos);
|
|
134
|
+
}
|
|
135
|
+
return folderWebRelativePath.replace('//', '/');
|
|
136
|
+
},
|
|
137
|
+
/**
|
|
138
|
+
* Returns the absolute URL according to a Web URL and the server relative URL of a folder
|
|
139
|
+
* @param webUrl The full URL of a web
|
|
140
|
+
* @param serverRelativeUrl The server relative URL of a folder
|
|
141
|
+
* @example
|
|
142
|
+
* // returns "https://contoso.sharepoint.com/sites/team1/Lists/MyList"
|
|
143
|
+
* urlUtil.getAbsoluteUrl("https://contoso.sharepoint.com/sites/team1/", "/sites/team1/Lists/MyList");
|
|
144
|
+
*/
|
|
145
|
+
getAbsoluteUrl(webUrl, serverRelativeUrl) {
|
|
146
|
+
const uri = url.parse(webUrl);
|
|
147
|
+
const tenantUrl = `${uri.protocol}//${uri.hostname}`;
|
|
148
|
+
if (serverRelativeUrl[0] !== '/') {
|
|
149
|
+
serverRelativeUrl = `/${serverRelativeUrl}`;
|
|
150
|
+
}
|
|
151
|
+
return `${tenantUrl}${serverRelativeUrl}`;
|
|
152
|
+
},
|
|
153
|
+
/**
|
|
154
|
+
* Combines base and relative url considering any missing slashes
|
|
155
|
+
* @param baseUrl https://contoso.com
|
|
156
|
+
* @param relativeUrl sites/abc
|
|
157
|
+
*/
|
|
158
|
+
urlCombine(baseUrl, relativeUrl) {
|
|
159
|
+
// remove last '/' of base if exists
|
|
160
|
+
if (baseUrl.lastIndexOf('/') === baseUrl.length - 1) {
|
|
161
|
+
baseUrl = baseUrl.substring(0, baseUrl.length - 1);
|
|
162
|
+
}
|
|
163
|
+
// remove '/' at 0
|
|
164
|
+
if (relativeUrl.charAt(0) === '/') {
|
|
165
|
+
relativeUrl = relativeUrl.substring(1, relativeUrl.length);
|
|
166
|
+
}
|
|
167
|
+
// remove last '/' of next if exists
|
|
168
|
+
if (relativeUrl.lastIndexOf('/') === relativeUrl.length - 1) {
|
|
169
|
+
relativeUrl = relativeUrl.substring(0, relativeUrl.length - 1);
|
|
170
|
+
}
|
|
171
|
+
return `${baseUrl}/${relativeUrl}`;
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
//# sourceMappingURL=urlUtil.js.map
|