@pnp/cli-microsoft365 9.0.0-beta.2f8dd1e → 9.0.0-beta.59b026e
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 -0
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Auth.js +10 -18
- package/dist/Command.js +49 -2
- package/dist/chili/chili.js +0 -23
- package/dist/cli/cli.js +61 -101
- package/dist/config.js +1 -1
- package/dist/m365/app/commands/permission/permission-add.js +9 -9
- package/dist/m365/commands/login.js +44 -96
- package/dist/m365/commands/setup.js +0 -4
- package/dist/m365/commands/status.js +2 -2
- package/dist/m365/connection/commands/connection-remove.js +6 -2
- package/dist/m365/connection/commands/connection-set.js +4 -1
- package/dist/m365/connection/commands/connection-use.js +25 -4
- package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-add.js +13 -13
- package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-get.js +18 -18
- package/dist/m365/entra/commands/enterpriseapp/enterpriseapp-list.js +1 -1
- package/dist/m365/entra/commands/group/group-user-list.js +4 -4
- package/dist/m365/entra/commands/m365group/m365group-conversation-post-list.js +4 -4
- package/dist/m365/entra/commands/m365group/m365group-recyclebinitem-list.js +3 -3
- package/dist/m365/entra/commands/m365group/m365group-set.js +66 -29
- package/dist/m365/entra/commands/m365group/m365group-user-add.js +109 -32
- package/dist/m365/entra/commands/m365group/m365group-user-list.js +6 -9
- package/dist/m365/entra/commands/m365group/m365group-user-set.js +159 -84
- package/dist/m365/entra/commands/multitenant/MultitenantOrganization.js +2 -0
- package/dist/m365/entra/commands/multitenant/multitenant-add.js +65 -0
- package/dist/m365/entra/commands/multitenant/multitenant-get.js +32 -0
- package/dist/m365/entra/commands/multitenant/multitenant-remove.js +118 -0
- package/dist/m365/entra/commands/multitenant/multitenant-set.js +72 -0
- package/dist/m365/entra/commands.js +4 -0
- package/dist/m365/external/commands/connection/connection-doctor.js +10 -24
- package/dist/m365/flow/commands/flow-get.js +1 -1
- package/dist/m365/flow/commands/flow-list.js +23 -24
- package/dist/m365/graph/commands/subscription/subscription-add.js +4 -2
- package/dist/m365/outlook/commands/message/message-get.js +11 -11
- package/dist/m365/spe/ContainerTypeProperties.js +2 -0
- package/dist/m365/spe/commands/containertype/containertype-list.js +49 -0
- package/dist/m365/spe/commands.js +2 -1
- package/dist/m365/spfx/commands/project/DeployWorkflow.js +1 -1
- package/dist/m365/spfx/commands/project/base-project-command.js +36 -126
- package/dist/m365/spfx/commands/project/project-github-workflow-add.js +1 -10
- package/dist/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.js +16 -21
- package/dist/m365/spo/commands/cdn/cdn-get.js +12 -15
- package/dist/m365/spo/commands/cdn/cdn-set.js +6 -4
- package/dist/m365/spo/commands/commandset/commandset-get.js +31 -17
- package/dist/m365/spo/commands/contenttype/contenttype-field-list.js +124 -0
- package/dist/m365/spo/commands/field/field-list.js +1 -1
- package/dist/m365/spo/commands/file/file-copy.js +55 -34
- package/dist/m365/spo/commands/file/file-roleassignment-add.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/folder/folder-retentionlabel-ensure.js +1 -1
- package/dist/m365/spo/commands/folder/folder-set.js +0 -4
- package/dist/m365/spo/commands/folder/folder-sharinglink-get.js +86 -0
- package/dist/m365/spo/commands/folder/folder-sharinglink-list.js +110 -0
- package/dist/m365/spo/commands/group/group-member-add.js +103 -99
- package/dist/m365/spo/commands/list/ListInstance.js +6 -1
- package/dist/m365/spo/commands/list/list-get.js +9 -3
- package/dist/m365/spo/commands/list/list-list.js +1 -4
- package/dist/m365/spo/commands/list/list-roleassignment-add.js +46 -21
- package/dist/m365/spo/commands/list/list-roleassignment-remove.js +48 -46
- package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +2 -3
- package/dist/m365/spo/commands/page/page-text-add.js +2 -3
- package/dist/m365/spo/commands/site/site-appcatalog-remove.js +48 -24
- package/dist/m365/spo/commands/site/site-remove.js +1 -7
- package/dist/m365/spo/commands/spo-search.js +3 -4
- package/dist/m365/spo/commands/tenant/tenant-applicationcustomizer-get.js +19 -5
- package/dist/m365/spo/commands/tenant/tenant-commandset-get.js +20 -6
- package/dist/m365/spo/commands/tenant/tenant-recyclebinitem-restore.js +2 -22
- package/dist/m365/spo/commands.js +3 -1
- package/dist/m365/teams/commands/meeting/meeting-attendancereport-get.js +119 -0
- package/dist/m365/teams/commands/message/message-remove.js +112 -0
- package/dist/m365/teams/commands.js +2 -0
- package/dist/m365/viva/commands/engage/engage-community-add.js +166 -0
- package/dist/m365/viva/commands.js +1 -0
- package/dist/utils/drive.js +61 -0
- package/dist/utils/formatting.js +30 -1
- package/dist/utils/spo.js +143 -6
- package/dist/utils/teams.js +49 -0
- package/dist/utils/validation.js +19 -0
- package/dist/utils/zod.js +124 -0
- package/docs/docs/cmd/app/permission/permission-add.mdx +5 -5
- package/docs/docs/cmd/connection/connection-use.mdx +8 -2
- package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-add.mdx +12 -12
- package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-get.mdx +14 -14
- package/docs/docs/cmd/entra/enterpriseapp/enterpriseapp-list.mdx +5 -5
- package/docs/docs/cmd/entra/group/group-user-list.mdx +7 -7
- package/docs/docs/cmd/entra/m365group/m365group-conversation-post-list.mdx +5 -5
- package/docs/docs/cmd/entra/m365group/m365group-recyclebinitem-list.mdx +3 -3
- package/docs/docs/cmd/entra/m365group/m365group-set.mdx +37 -7
- package/docs/docs/cmd/entra/m365group/m365group-user-add.mdx +28 -10
- package/docs/docs/cmd/entra/m365group/m365group-user-list.mdx +1 -1
- package/docs/docs/cmd/entra/m365group/m365group-user-set.mdx +35 -11
- package/docs/docs/cmd/entra/multitenant/multitenant-add.mdx +107 -0
- package/docs/docs/cmd/entra/multitenant/multitenant-get.mdx +94 -0
- package/docs/docs/cmd/entra/multitenant/multitenant-remove.mdx +58 -0
- package/docs/docs/cmd/entra/multitenant/multitenant-set.mdx +53 -0
- package/docs/docs/cmd/external/connection/connection-doctor.mdx +9 -9
- package/docs/docs/cmd/flow/flow-get.mdx +149 -283
- package/docs/docs/cmd/flow/flow-list.mdx +114 -56
- package/docs/docs/cmd/graph/subscription/subscription-add.mdx +18 -0
- package/docs/docs/cmd/outlook/message/message-get.mdx +5 -5
- package/docs/docs/cmd/planner/plan/plan-remove.mdx +1 -1
- package/docs/docs/cmd/spe/containertype/containertype-list.mdx +102 -0
- package/docs/docs/cmd/spfx/project/project-github-workflow-add.mdx +11 -12
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-get.mdx +87 -38
- package/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-list.mdx +22 -28
- package/docs/docs/cmd/spo/cdn/cdn-set.mdx +3 -3
- package/docs/docs/cmd/spo/commandset/commandset-get.mdx +75 -24
- package/docs/docs/cmd/spo/commandset/commandset-list.mdx +26 -32
- package/docs/docs/cmd/spo/contenttype/contenttype-field-list.mdx +172 -0
- package/docs/docs/cmd/spo/contenttype/contenttype-list.mdx +3 -3
- package/docs/docs/cmd/spo/field/field-list.mdx +3 -3
- package/docs/docs/cmd/spo/file/file-copy.mdx +119 -12
- package/docs/docs/cmd/spo/file/file-retentionlabel-ensure.mdx +1 -1
- package/docs/docs/cmd/spo/file/file-roleassignment-add.mdx +2 -2
- 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/folder/folder-retentionlabel-ensure.mdx +2 -2
- package/docs/docs/cmd/spo/folder/folder-set.mdx +0 -6
- package/docs/docs/cmd/spo/folder/folder-sharinglink-get.mdx +110 -0
- package/docs/docs/cmd/spo/folder/folder-sharinglink-list.mdx +114 -0
- package/docs/docs/cmd/spo/group/group-member-add.mdx +34 -27
- package/docs/docs/cmd/spo/list/list-get.mdx +6 -0
- package/docs/docs/cmd/spo/list/list-list.mdx +5 -7
- package/docs/docs/cmd/spo/list/list-roleassignment-add.mdx +15 -3
- package/docs/docs/cmd/spo/list/list-roleassignment-remove.mdx +15 -3
- package/docs/docs/cmd/spo/listitem/listitem-retentionlabel-ensure.mdx +4 -4
- package/docs/docs/cmd/spo/listitem/listitem-retentionlabel-remove.mdx +1 -1
- package/docs/docs/cmd/spo/listitem/listitem-roleassignment-add.mdx +9 -9
- package/docs/docs/cmd/spo/listitem/listitem-roleassignment-remove.mdx +7 -7
- package/docs/docs/cmd/spo/site/site-appcatalog-remove.mdx +11 -2
- package/docs/docs/cmd/spo/site/site-recyclebinitem-list.mdx +1 -1
- package/docs/docs/cmd/spo/site/site-remove.mdx +0 -3
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-get.mdx +79 -30
- package/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.mdx +20 -19
- package/docs/docs/cmd/spo/tenant/tenant-commandset-get.mdx +84 -38
- package/docs/docs/cmd/spo/tenant/tenant-commandset-list.mdx +20 -19
- package/docs/docs/cmd/spo/tenant/tenant-recyclebinitem-restore.mdx +2 -49
- package/docs/docs/cmd/spo/web/web-roleassignment-add.mdx +1 -1
- package/docs/docs/cmd/spo/web/web-roleassignment-remove.mdx +1 -1
- package/docs/docs/cmd/teams/meeting/meeting-attendancereport-get.mdx +138 -0
- package/docs/docs/cmd/teams/meeting/meeting-list.mdx +7 -3
- package/docs/docs/cmd/teams/message/message-remove.mdx +63 -0
- package/docs/docs/cmd/viva/engage/engage-community-add.mdx +168 -0
- package/npm-shrinkwrap.json +588 -1022
- package/package.json +7 -3
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
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
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var _SpoFolderSharingLinkGetCommand_instances, _SpoFolderSharingLinkGetCommand_initTelemetry, _SpoFolderSharingLinkGetCommand_initOptions, _SpoFolderSharingLinkGetCommand_initOptionSets, _SpoFolderSharingLinkGetCommand_initValidators, _SpoFolderSharingLinkGetCommand_initTypes;
|
|
7
|
+
import request from '../../../../request.js';
|
|
8
|
+
import { spo } from '../../../../utils/spo.js';
|
|
9
|
+
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
10
|
+
import { validation } from '../../../../utils/validation.js';
|
|
11
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
12
|
+
import commands from '../../commands.js';
|
|
13
|
+
import { drive as driveItem } from '../../../../utils/drive.js';
|
|
14
|
+
class SpoFolderSharingLinkGetCommand extends SpoCommand {
|
|
15
|
+
get name() {
|
|
16
|
+
return commands.FOLDER_SHARINGLINK_GET;
|
|
17
|
+
}
|
|
18
|
+
get description() {
|
|
19
|
+
return 'Gets details about a specific sharing link on a folder';
|
|
20
|
+
}
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
_SpoFolderSharingLinkGetCommand_instances.add(this);
|
|
24
|
+
__classPrivateFieldGet(this, _SpoFolderSharingLinkGetCommand_instances, "m", _SpoFolderSharingLinkGetCommand_initTelemetry).call(this);
|
|
25
|
+
__classPrivateFieldGet(this, _SpoFolderSharingLinkGetCommand_instances, "m", _SpoFolderSharingLinkGetCommand_initOptions).call(this);
|
|
26
|
+
__classPrivateFieldGet(this, _SpoFolderSharingLinkGetCommand_instances, "m", _SpoFolderSharingLinkGetCommand_initOptionSets).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoFolderSharingLinkGetCommand_instances, "m", _SpoFolderSharingLinkGetCommand_initValidators).call(this);
|
|
28
|
+
__classPrivateFieldGet(this, _SpoFolderSharingLinkGetCommand_instances, "m", _SpoFolderSharingLinkGetCommand_initTypes).call(this);
|
|
29
|
+
}
|
|
30
|
+
async commandAction(logger, args) {
|
|
31
|
+
if (this.verbose) {
|
|
32
|
+
await logger.logToStderr(`Retrieving sharing link on folder ${args.options.folderId || args.options.folderUrl}...`);
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
const relFolderUrl = await spo.getFolderServerRelativeUrl(args.options.webUrl, args.options.folderUrl, args.options.folderId);
|
|
36
|
+
const absoluteFolderUrl = urlUtil.getAbsoluteUrl(args.options.webUrl, relFolderUrl);
|
|
37
|
+
const folderUrl = new URL(absoluteFolderUrl);
|
|
38
|
+
const siteId = await spo.getSiteId(args.options.webUrl);
|
|
39
|
+
const drive = await driveItem.getDriveByUrl(siteId, folderUrl);
|
|
40
|
+
const itemId = await driveItem.getDriveItemId(drive, folderUrl);
|
|
41
|
+
const requestUrl = `https://graph.microsoft.com/v1.0/drives/${drive.id}/items/${itemId}/permissions/${args.options.id}`;
|
|
42
|
+
const requestOptions = {
|
|
43
|
+
url: requestUrl,
|
|
44
|
+
headers: {
|
|
45
|
+
'accept': 'application/json;odata.metadata=none'
|
|
46
|
+
},
|
|
47
|
+
responseType: 'json'
|
|
48
|
+
};
|
|
49
|
+
const permission = await request.get(requestOptions);
|
|
50
|
+
await logger.log(permission);
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
this.handleRejectedODataJsonPromise(err);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
_SpoFolderSharingLinkGetCommand_instances = new WeakSet(), _SpoFolderSharingLinkGetCommand_initTelemetry = function _SpoFolderSharingLinkGetCommand_initTelemetry() {
|
|
58
|
+
this.telemetry.push((args) => {
|
|
59
|
+
Object.assign(this.telemetryProperties, {
|
|
60
|
+
folderUrl: typeof args.options.folderUrl !== 'undefined',
|
|
61
|
+
folderId: typeof args.options.folderId !== 'undefined'
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}, _SpoFolderSharingLinkGetCommand_initOptions = function _SpoFolderSharingLinkGetCommand_initOptions() {
|
|
65
|
+
this.options.unshift({ option: '-u, --webUrl <webUrl>' }, { option: '--folderUrl [folderUrl]' }, { option: '--folderId [folderId]' }, { option: '-i, --id <id>' });
|
|
66
|
+
}, _SpoFolderSharingLinkGetCommand_initOptionSets = function _SpoFolderSharingLinkGetCommand_initOptionSets() {
|
|
67
|
+
this.optionSets.push({ options: ['folderUrl', 'folderId'] });
|
|
68
|
+
}, _SpoFolderSharingLinkGetCommand_initValidators = function _SpoFolderSharingLinkGetCommand_initValidators() {
|
|
69
|
+
this.validators.push(async (args) => {
|
|
70
|
+
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
71
|
+
if (isValidSharePointUrl !== true) {
|
|
72
|
+
return isValidSharePointUrl;
|
|
73
|
+
}
|
|
74
|
+
if (args.options.folderId && !validation.isValidGuid(args.options.folderId)) {
|
|
75
|
+
return `${args.options.folderId} is not a valid GUID for option 'folderId'.`;
|
|
76
|
+
}
|
|
77
|
+
if (!validation.isValidGuid(args.options.id)) {
|
|
78
|
+
return `${args.options.id} is not a valid GUID for option 'id'.`;
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
});
|
|
82
|
+
}, _SpoFolderSharingLinkGetCommand_initTypes = function _SpoFolderSharingLinkGetCommand_initTypes() {
|
|
83
|
+
this.types.string.push('webUrl', 'folderUrl', 'folderId', 'id');
|
|
84
|
+
};
|
|
85
|
+
export default new SpoFolderSharingLinkGetCommand();
|
|
86
|
+
//# sourceMappingURL=folder-sharinglink-get.js.map
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
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
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var _SpoFolderSharingLinkListCommand_instances, _SpoFolderSharingLinkListCommand_initTelemetry, _SpoFolderSharingLinkListCommand_initOptions, _SpoFolderSharingLinkListCommand_initOptionSets, _SpoFolderSharingLinkListCommand_initValidators, _SpoFolderSharingLinkListCommand_initTypes;
|
|
7
|
+
import { cli } from '../../../../cli/cli.js';
|
|
8
|
+
import { spo } from '../../../../utils/spo.js';
|
|
9
|
+
import { odata } from '../../../../utils/odata.js';
|
|
10
|
+
import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
11
|
+
import { drive } from '../../../../utils/drive.js';
|
|
12
|
+
import { validation } from '../../../../utils/validation.js';
|
|
13
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
14
|
+
import commands from '../../commands.js';
|
|
15
|
+
class SpoFolderSharingLinkListCommand extends SpoCommand {
|
|
16
|
+
get name() {
|
|
17
|
+
return commands.FOLDER_SHARINGLINK_LIST;
|
|
18
|
+
}
|
|
19
|
+
get description() {
|
|
20
|
+
return 'Lists all the sharing links of a specific folder';
|
|
21
|
+
}
|
|
22
|
+
defaultProperties() {
|
|
23
|
+
return ['id', 'scope', 'roles', 'link'];
|
|
24
|
+
}
|
|
25
|
+
constructor() {
|
|
26
|
+
super();
|
|
27
|
+
_SpoFolderSharingLinkListCommand_instances.add(this);
|
|
28
|
+
this.allowedScopes = ['anonymous', 'users', 'organization'];
|
|
29
|
+
__classPrivateFieldGet(this, _SpoFolderSharingLinkListCommand_instances, "m", _SpoFolderSharingLinkListCommand_initTelemetry).call(this);
|
|
30
|
+
__classPrivateFieldGet(this, _SpoFolderSharingLinkListCommand_instances, "m", _SpoFolderSharingLinkListCommand_initOptions).call(this);
|
|
31
|
+
__classPrivateFieldGet(this, _SpoFolderSharingLinkListCommand_instances, "m", _SpoFolderSharingLinkListCommand_initOptionSets).call(this);
|
|
32
|
+
__classPrivateFieldGet(this, _SpoFolderSharingLinkListCommand_instances, "m", _SpoFolderSharingLinkListCommand_initValidators).call(this);
|
|
33
|
+
__classPrivateFieldGet(this, _SpoFolderSharingLinkListCommand_instances, "m", _SpoFolderSharingLinkListCommand_initTypes).call(this);
|
|
34
|
+
}
|
|
35
|
+
async commandAction(logger, args) {
|
|
36
|
+
if (this.verbose) {
|
|
37
|
+
await logger.logToStderr(`Retrieving sharing links for folder ${args.options.folderId || args.options.folderUrl}...`);
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
const relFolderUrl = await spo.getFolderServerRelativeUrl(args.options.webUrl, args.options.folderUrl, args.options.folderId, logger, args.options.verbose);
|
|
41
|
+
const absoluteFolderUrl = urlUtil.getAbsoluteUrl(args.options.webUrl, relFolderUrl);
|
|
42
|
+
const folderUrl = new URL(absoluteFolderUrl);
|
|
43
|
+
const siteId = await spo.getSiteId(args.options.webUrl);
|
|
44
|
+
const driveDetails = await drive.getDriveByUrl(siteId, folderUrl, logger, args.options.verbose);
|
|
45
|
+
const itemId = await drive.getDriveItemId(driveDetails, folderUrl, logger, args.options.verbose);
|
|
46
|
+
let requestUrl = `https://graph.microsoft.com/v1.0/drives/${driveDetails.id}/items/${itemId}/permissions?$filter=Link ne null`;
|
|
47
|
+
if (args.options.scope) {
|
|
48
|
+
requestUrl += ` and Link/Scope eq '${args.options.scope}'`;
|
|
49
|
+
}
|
|
50
|
+
const sharingLinks = await odata.getAllItems(requestUrl);
|
|
51
|
+
// remove grantedToIdentities from the sharing link object
|
|
52
|
+
const filteredSharingLinks = sharingLinks.map(link => {
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
54
|
+
const { grantedToIdentities, ...filteredLink } = link;
|
|
55
|
+
return filteredLink;
|
|
56
|
+
});
|
|
57
|
+
if (!args.options.output || !cli.shouldTrimOutput(args.options.output)) {
|
|
58
|
+
await logger.log(filteredSharingLinks);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
//converted to text friendly output
|
|
62
|
+
await logger.log(filteredSharingLinks.map(i => {
|
|
63
|
+
return {
|
|
64
|
+
id: i.id,
|
|
65
|
+
roles: i.roles.join(','),
|
|
66
|
+
link: i.link.webUrl,
|
|
67
|
+
scope: i.link.scope
|
|
68
|
+
};
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
this.handleRejectedODataJsonPromise(err);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
_SpoFolderSharingLinkListCommand_instances = new WeakSet(), _SpoFolderSharingLinkListCommand_initTelemetry = function _SpoFolderSharingLinkListCommand_initTelemetry() {
|
|
78
|
+
this.telemetry.push((args) => {
|
|
79
|
+
Object.assign(this.telemetryProperties, {
|
|
80
|
+
folderUrl: typeof args.options.folderUrl !== 'undefined',
|
|
81
|
+
folderId: typeof args.options.folderId !== 'undefined',
|
|
82
|
+
scope: typeof args.options.scope !== 'undefined'
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}, _SpoFolderSharingLinkListCommand_initOptions = function _SpoFolderSharingLinkListCommand_initOptions() {
|
|
86
|
+
this.options.unshift({ option: '-u, --webUrl <webUrl>' }, { option: '--folderUrl [folderUrl]' }, { option: '--folderId [folderId]' }, {
|
|
87
|
+
option: '-s, --scope [scope]',
|
|
88
|
+
autocomplete: this.allowedScopes
|
|
89
|
+
});
|
|
90
|
+
}, _SpoFolderSharingLinkListCommand_initOptionSets = function _SpoFolderSharingLinkListCommand_initOptionSets() {
|
|
91
|
+
this.optionSets.push({ options: ['folderUrl', 'folderId'] });
|
|
92
|
+
}, _SpoFolderSharingLinkListCommand_initValidators = function _SpoFolderSharingLinkListCommand_initValidators() {
|
|
93
|
+
this.validators.push(async (args) => {
|
|
94
|
+
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.webUrl);
|
|
95
|
+
if (isValidSharePointUrl !== true) {
|
|
96
|
+
return isValidSharePointUrl;
|
|
97
|
+
}
|
|
98
|
+
if (args.options.folderId && !validation.isValidGuid(args.options.folderId)) {
|
|
99
|
+
return `${args.options.folderId} is not a valid GUID`;
|
|
100
|
+
}
|
|
101
|
+
if (args.options.scope && !this.allowedScopes.some(scope => scope === args.options.scope)) {
|
|
102
|
+
return `'${args.options.scope}' is not a valid scope. Allowed values are: ${this.allowedScopes.join(',')}`;
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
105
|
+
});
|
|
106
|
+
}, _SpoFolderSharingLinkListCommand_initTypes = function _SpoFolderSharingLinkListCommand_initTypes() {
|
|
107
|
+
this.types.string.push('webUrl', 'folderUrl', 'folderId', 'scope');
|
|
108
|
+
};
|
|
109
|
+
export default new SpoFolderSharingLinkListCommand();
|
|
110
|
+
//# sourceMappingURL=folder-sharinglink-list.js.map
|
|
@@ -3,12 +3,10 @@ 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 _SpoGroupMemberAddCommand_instances, _SpoGroupMemberAddCommand_initTelemetry, _SpoGroupMemberAddCommand_initOptions, _SpoGroupMemberAddCommand_initValidators, _SpoGroupMemberAddCommand_initOptionSets;
|
|
6
|
+
var _SpoGroupMemberAddCommand_instances, _SpoGroupMemberAddCommand_initTelemetry, _SpoGroupMemberAddCommand_initOptions, _SpoGroupMemberAddCommand_initValidators, _SpoGroupMemberAddCommand_initOptionSets, _SpoGroupMemberAddCommand_initTypes;
|
|
7
7
|
import request from '../../../../request.js';
|
|
8
8
|
import { entraGroup } from '../../../../utils/entraGroup.js';
|
|
9
|
-
import { entraUser } from '../../../../utils/entraUser.js';
|
|
10
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
11
|
-
import { spo } from '../../../../utils/spo.js';
|
|
12
10
|
import { validation } from '../../../../utils/validation.js';
|
|
13
11
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
14
12
|
import commands from '../../commands.js';
|
|
@@ -20,7 +18,7 @@ class SpoGroupMemberAddCommand extends SpoCommand {
|
|
|
20
18
|
return 'Add members to a SharePoint Group';
|
|
21
19
|
}
|
|
22
20
|
defaultProperties() {
|
|
23
|
-
return ['
|
|
21
|
+
return ['Title', 'UserPrincipalName'];
|
|
24
22
|
}
|
|
25
23
|
constructor() {
|
|
26
24
|
super();
|
|
@@ -29,110 +27,100 @@ class SpoGroupMemberAddCommand extends SpoCommand {
|
|
|
29
27
|
__classPrivateFieldGet(this, _SpoGroupMemberAddCommand_instances, "m", _SpoGroupMemberAddCommand_initOptions).call(this);
|
|
30
28
|
__classPrivateFieldGet(this, _SpoGroupMemberAddCommand_instances, "m", _SpoGroupMemberAddCommand_initValidators).call(this);
|
|
31
29
|
__classPrivateFieldGet(this, _SpoGroupMemberAddCommand_instances, "m", _SpoGroupMemberAddCommand_initOptionSets).call(this);
|
|
30
|
+
__classPrivateFieldGet(this, _SpoGroupMemberAddCommand_instances, "m", _SpoGroupMemberAddCommand_initTypes).call(this);
|
|
32
31
|
}
|
|
33
32
|
async commandAction(logger, args) {
|
|
34
33
|
try {
|
|
35
34
|
if (args.options.aadGroupIds) {
|
|
36
35
|
args.options.entraGroupIds = args.options.aadGroupIds;
|
|
37
|
-
await this.warn(logger, `Option 'aadGroupIds' is deprecated. Please use 'entraGroupIds' instead
|
|
36
|
+
await this.warn(logger, `Option 'aadGroupIds' is deprecated. Please use 'entraGroupIds' instead.`);
|
|
38
37
|
}
|
|
39
38
|
if (args.options.aadGroupNames) {
|
|
40
39
|
args.options.entraGroupNames = args.options.aadGroupNames;
|
|
41
|
-
await this.warn(logger, `Option 'aadGroupNames' is deprecated. Please use 'entraGroupNames' instead
|
|
40
|
+
await this.warn(logger, `Option 'aadGroupNames' is deprecated. Please use 'entraGroupNames' instead.`);
|
|
42
41
|
}
|
|
43
|
-
const
|
|
44
|
-
|
|
42
|
+
const loginNames = await this.getLoginNames(logger, args.options);
|
|
43
|
+
let apiUrl = `${args.options.webUrl}/_api/web/SiteGroups`;
|
|
44
|
+
if (args.options.groupId) {
|
|
45
|
+
apiUrl += `/GetById(${args.options.groupId})`;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
apiUrl += `/GetByName('${formatting.encodeQueryParameter(args.options.groupName)}')`;
|
|
49
|
+
}
|
|
50
|
+
apiUrl += '/users';
|
|
45
51
|
if (this.verbose) {
|
|
46
|
-
await logger.logToStderr(
|
|
47
|
-
}
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (sharingResult.ErrorMessage !== null) {
|
|
63
|
-
throw sharingResult.ErrorMessage;
|
|
52
|
+
await logger.logToStderr('Adding members to group...');
|
|
53
|
+
}
|
|
54
|
+
const result = [];
|
|
55
|
+
for (const loginName of loginNames) {
|
|
56
|
+
const requestOptions = {
|
|
57
|
+
url: apiUrl,
|
|
58
|
+
headers: {
|
|
59
|
+
accept: 'application/json;odata=nometadata'
|
|
60
|
+
},
|
|
61
|
+
responseType: 'json',
|
|
62
|
+
data: {
|
|
63
|
+
LoginName: loginName
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const response = await request.post(requestOptions);
|
|
67
|
+
result.push(response);
|
|
64
68
|
}
|
|
65
|
-
await logger.log(
|
|
69
|
+
await logger.log(result);
|
|
66
70
|
}
|
|
67
71
|
catch (err) {
|
|
68
72
|
this.handleRejectedODataJsonPromise(err);
|
|
69
73
|
}
|
|
70
74
|
}
|
|
71
|
-
async
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const getGroupMethod = args.options.groupName ?
|
|
76
|
-
`GetByName('${formatting.encodeQueryParameter(args.options.groupName)}')` :
|
|
77
|
-
`GetById('${args.options.groupId}')`;
|
|
78
|
-
const requestOptions = {
|
|
79
|
-
url: `${args.options.webUrl}/_api/web/sitegroups/${getGroupMethod}?$select=Id`,
|
|
80
|
-
headers: {
|
|
81
|
-
'accept': 'application/json;odata=nometadata'
|
|
82
|
-
},
|
|
83
|
-
responseType: 'json'
|
|
84
|
-
};
|
|
85
|
-
const response = await request.get(requestOptions);
|
|
86
|
-
return response.Id;
|
|
87
|
-
}
|
|
88
|
-
async getValidUsers(args, logger) {
|
|
89
|
-
if (this.verbose) {
|
|
90
|
-
await logger.logToStderr('Checking if the specified users and groups exist');
|
|
75
|
+
async getLoginNames(logger, options) {
|
|
76
|
+
const loginNames = [];
|
|
77
|
+
if (options.userNames || options.emails) {
|
|
78
|
+
loginNames.push(...formatting.splitAndTrim(options.userNames || options.emails).map(u => `i:0#.f|membership|${u}`));
|
|
91
79
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
validUserNames.push(spoUserAzureId);
|
|
103
|
-
}
|
|
104
|
-
else if (args.options.userNames) {
|
|
105
|
-
validUserNames.push(trimmedIdentifier);
|
|
106
|
-
}
|
|
107
|
-
else if (args.options.entraGroupIds) {
|
|
108
|
-
validUserNames.push(trimmedIdentifier);
|
|
109
|
-
}
|
|
110
|
-
else if (args.options.entraGroupNames) {
|
|
111
|
-
if (this.verbose) {
|
|
112
|
-
await logger.logToStderr(`Getting ID of Microsoft Entra group ${trimmedIdentifier}`);
|
|
113
|
-
}
|
|
114
|
-
const groupId = await entraGroup.getGroupIdByDisplayName(trimmedIdentifier);
|
|
115
|
-
validUserNames.push(groupId);
|
|
80
|
+
else if (options.entraGroupIds || options.entraGroupNames) {
|
|
81
|
+
if (this.verbose) {
|
|
82
|
+
await logger.logToStderr(`Resolving ${(options.entraGroupIds || options.entraGroupNames).length} group(s)...`);
|
|
83
|
+
}
|
|
84
|
+
const groups = [];
|
|
85
|
+
if (options.entraGroupIds) {
|
|
86
|
+
const groupIds = formatting.splitAndTrim(options.entraGroupIds);
|
|
87
|
+
for (const groupId of groupIds) {
|
|
88
|
+
const group = await entraGroup.getGroupById(groupId);
|
|
89
|
+
groups.push(group);
|
|
116
90
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
const groupNames = formatting.splitAndTrim(options.entraGroupNames);
|
|
94
|
+
for (const groupName of groupNames) {
|
|
95
|
+
const group = await entraGroup.getGroupByDisplayName(groupName);
|
|
96
|
+
groups.push(group);
|
|
123
97
|
}
|
|
124
98
|
}
|
|
125
|
-
|
|
126
|
-
|
|
99
|
+
// Check if group is M365 group or security group
|
|
100
|
+
loginNames.push(...groups.map(g => g.mailEnabled ? `c:0o.c|federateddirectoryclaimprovider|${g.id}` : `c:0t.c|tenant|${g.id}`));
|
|
101
|
+
}
|
|
102
|
+
else if (options.userIds) {
|
|
103
|
+
const userIds = formatting.splitAndTrim(options.userIds);
|
|
104
|
+
if (this.verbose) {
|
|
105
|
+
await logger.logToStderr(`Resolving ${userIds.length} user(s)...`);
|
|
127
106
|
}
|
|
128
|
-
|
|
129
|
-
|
|
107
|
+
for (const userId of userIds) {
|
|
108
|
+
const loginName = await this.getUserLoginNameById(options.webUrl, parseInt(userId));
|
|
109
|
+
loginNames.push(loginName);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return loginNames;
|
|
130
113
|
}
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
114
|
+
async getUserLoginNameById(webUrl, userId) {
|
|
115
|
+
const requestOptions = {
|
|
116
|
+
url: `${webUrl}/_api/web/SiteUsers/GetById(${userId})?$select=LoginName`,
|
|
117
|
+
headers: {
|
|
118
|
+
accept: 'application/json;odata=nometadata'
|
|
119
|
+
},
|
|
120
|
+
responseType: 'json'
|
|
121
|
+
};
|
|
122
|
+
const user = await request.get(requestOptions);
|
|
123
|
+
return user.LoginName;
|
|
136
124
|
}
|
|
137
125
|
}
|
|
138
126
|
_SpoGroupMemberAddCommand_instances = new WeakSet(), _SpoGroupMemberAddCommand_initTelemetry = function _SpoGroupMemberAddCommand_initTelemetry() {
|
|
@@ -177,29 +165,45 @@ _SpoGroupMemberAddCommand_instances = new WeakSet(), _SpoGroupMemberAddCommand_i
|
|
|
177
165
|
if (isValidSharePointUrl !== true) {
|
|
178
166
|
return isValidSharePointUrl;
|
|
179
167
|
}
|
|
180
|
-
if (args.options.groupId &&
|
|
181
|
-
return `Specified groupId ${args.options.groupId} is not a number
|
|
168
|
+
if (args.options.groupId && !validation.isValidPositiveInteger(args.options.groupId)) {
|
|
169
|
+
return `Specified groupId ${args.options.groupId} is not a positive number.`;
|
|
182
170
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
171
|
+
if (args.options.userIds) {
|
|
172
|
+
const isValidArray = validation.isValidPositiveIntegerArray(args.options.userIds);
|
|
173
|
+
if (isValidArray !== true) {
|
|
174
|
+
return `Option 'userIds' contains one or more invalid numbers: ${isValidArray}.`;
|
|
175
|
+
}
|
|
186
176
|
}
|
|
187
|
-
if (args.options.userNames
|
|
188
|
-
|
|
177
|
+
if (args.options.userNames) {
|
|
178
|
+
const isValidArray = validation.isValidUserPrincipalNameArray(args.options.userNames);
|
|
179
|
+
if (isValidArray !== true) {
|
|
180
|
+
return `Option 'userNames' contains one or more invalid UPNs: ${isValidArray}.`;
|
|
181
|
+
}
|
|
189
182
|
}
|
|
190
|
-
if (args.options.emails
|
|
191
|
-
|
|
183
|
+
if (args.options.emails) {
|
|
184
|
+
const isValidArray = validation.isValidUserPrincipalNameArray(args.options.emails);
|
|
185
|
+
if (isValidArray !== true) {
|
|
186
|
+
return `Option 'emails' contains one or more invalid UPNs: ${isValidArray}.`;
|
|
187
|
+
}
|
|
192
188
|
}
|
|
193
|
-
if (args.options.entraGroupIds
|
|
194
|
-
|
|
189
|
+
if (args.options.entraGroupIds) {
|
|
190
|
+
const isValidArray = validation.isValidGuidArray(args.options.entraGroupIds);
|
|
191
|
+
if (isValidArray !== true) {
|
|
192
|
+
return `Option 'entraGroupIds' contains one or more invalid GUIDs: ${isValidArray}.`;
|
|
193
|
+
}
|
|
195
194
|
}
|
|
196
|
-
if (args.options.aadGroupIds
|
|
197
|
-
|
|
195
|
+
if (args.options.aadGroupIds) {
|
|
196
|
+
const isValidArray = validation.isValidGuidArray(args.options.aadGroupIds);
|
|
197
|
+
if (isValidArray !== true) {
|
|
198
|
+
return `Option 'aadGroupIds' contains one or more invalid GUIDs: ${isValidArray}.`;
|
|
199
|
+
}
|
|
198
200
|
}
|
|
199
201
|
return true;
|
|
200
202
|
});
|
|
201
203
|
}, _SpoGroupMemberAddCommand_initOptionSets = function _SpoGroupMemberAddCommand_initOptionSets() {
|
|
202
204
|
this.optionSets.push({ options: ['groupId', 'groupName'] }, { options: ['userNames', 'emails', 'userIds', 'entraGroupIds', 'aadGroupIds', 'entraGroupNames', 'aadGroupNames'] });
|
|
205
|
+
}, _SpoGroupMemberAddCommand_initTypes = function _SpoGroupMemberAddCommand_initTypes() {
|
|
206
|
+
this.types.string.push('webUrl', 'groupName', 'userNames', 'emails', 'userIds', 'entraGroupIds', 'aadGroupIds', 'entraGroupNames', 'aadGroupNames');
|
|
203
207
|
};
|
|
204
208
|
export default new SpoGroupMemberAddCommand();
|
|
205
209
|
//# sourceMappingURL=group-member-add.js.map
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
export
|
|
1
|
+
export var DefaultTrimModeType;
|
|
2
|
+
(function (DefaultTrimModeType) {
|
|
3
|
+
DefaultTrimModeType[DefaultTrimModeType["NoExpiration"] = 0] = "NoExpiration";
|
|
4
|
+
DefaultTrimModeType[DefaultTrimModeType["ExpireAfter"] = 1] = "ExpireAfter";
|
|
5
|
+
DefaultTrimModeType[DefaultTrimModeType["AutoExpiration"] = 2] = "AutoExpiration";
|
|
6
|
+
})(DefaultTrimModeType || (DefaultTrimModeType = {}));
|
|
2
7
|
//# sourceMappingURL=ListInstance.js.map
|
|
@@ -10,6 +10,7 @@ import { urlUtil } from '../../../../utils/urlUtil.js';
|
|
|
10
10
|
import { validation } from '../../../../utils/validation.js';
|
|
11
11
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
12
12
|
import commands from '../../commands.js';
|
|
13
|
+
import { DefaultTrimModeType } from "./ListInstance.js";
|
|
13
14
|
import { ListPrincipalType } from './ListPrincipalType.js';
|
|
14
15
|
class SpoListGetCommand extends SpoCommand {
|
|
15
16
|
get name() {
|
|
@@ -49,9 +50,11 @@ class SpoListGetCommand extends SpoCommand {
|
|
|
49
50
|
if (fieldsProperties.expandProperties.length > 0) {
|
|
50
51
|
queryParams.push(`$expand=${fieldsProperties.expandProperties.join(',')}`);
|
|
51
52
|
}
|
|
52
|
-
|
|
53
|
+
if (queryParams.length === 0) {
|
|
54
|
+
queryParams.push(`$expand=VersionPolicies`);
|
|
55
|
+
}
|
|
53
56
|
const requestOptions = {
|
|
54
|
-
url: `${requestUrl}
|
|
57
|
+
url: `${requestUrl}?${queryParams.join('&')}`,
|
|
55
58
|
headers: {
|
|
56
59
|
'accept': 'application/json;odata=nometadata'
|
|
57
60
|
},
|
|
@@ -64,6 +67,9 @@ class SpoListGetCommand extends SpoCommand {
|
|
|
64
67
|
r.Member.PrincipalTypeString = ListPrincipalType[r.Member.PrincipalType];
|
|
65
68
|
});
|
|
66
69
|
}
|
|
70
|
+
if (listInstance.VersionPolicies) {
|
|
71
|
+
listInstance.VersionPolicies.DefaultTrimModeValue = DefaultTrimModeType[listInstance.VersionPolicies.DefaultTrimMode];
|
|
72
|
+
}
|
|
67
73
|
await logger.log(listInstance);
|
|
68
74
|
}
|
|
69
75
|
catch (err) {
|
|
@@ -74,7 +80,7 @@ class SpoListGetCommand extends SpoCommand {
|
|
|
74
80
|
const selectProperties = [];
|
|
75
81
|
let expandProperties = [];
|
|
76
82
|
if (withPermissions) {
|
|
77
|
-
expandProperties = ['HasUniqueRoleAssignments', 'RoleAssignments/Member', 'RoleAssignments/RoleDefinitionBindings'];
|
|
83
|
+
expandProperties = ['HasUniqueRoleAssignments', 'RoleAssignments/Member', 'RoleAssignments/RoleDefinitionBindings', 'VersionPolicies'];
|
|
78
84
|
}
|
|
79
85
|
if (properties) {
|
|
80
86
|
properties.split(',').forEach((property) => {
|
|
@@ -16,7 +16,7 @@ class SpoListListCommand extends SpoCommand {
|
|
|
16
16
|
return 'Lists all available list in the specified site';
|
|
17
17
|
}
|
|
18
18
|
defaultProperties() {
|
|
19
|
-
return ['Title', '
|
|
19
|
+
return ['Title', 'Id'];
|
|
20
20
|
}
|
|
21
21
|
constructor() {
|
|
22
22
|
super();
|
|
@@ -36,9 +36,6 @@ class SpoListListCommand extends SpoCommand {
|
|
|
36
36
|
queryParams.push(`$filter=${args.options.filter}`);
|
|
37
37
|
}
|
|
38
38
|
const listInstances = await odata.getAllItems(`${args.options.webUrl}/_api/web/lists?${queryParams.join('&')}`);
|
|
39
|
-
listInstances.forEach(l => {
|
|
40
|
-
l.Url = l.RootFolder.ServerRelativeUrl;
|
|
41
|
-
});
|
|
42
39
|
await logger.log(listInstances);
|
|
43
40
|
}
|
|
44
41
|
catch (err) {
|