@pnp/cli-microsoft365 10.0.0-beta.7dfc31a → 10.0.0-beta.a868b81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/Auth.js +11 -12
- package/dist/cli/cli.js +14 -0
- package/dist/config.js +60 -5
- package/dist/m365/base/PowerAutomateCommand.js +1 -1
- package/dist/m365/base/SpoCommand.js +1 -1
- package/dist/m365/cli/commands/cli-consent.js +2 -2
- package/dist/m365/cli/commands/cli-doctor.js +2 -2
- package/dist/m365/cli/commands/cli-reconsent.js +2 -3
- package/dist/m365/cli/commands/config/config-set.js +12 -4
- package/dist/m365/commands/login.js +28 -9
- package/dist/m365/commands/setup.js +256 -33
- package/dist/m365/commands/setupPresets.js +2 -4
- package/dist/m365/connection/commands/connection-list.js +4 -4
- package/dist/m365/entra/commands/app/app-add.js +52 -288
- package/dist/m365/flow/commands/environment/environment-get.js +1 -1
- package/dist/m365/flow/commands/environment/environment-list.js +1 -1
- package/dist/m365/flow/commands/flow-disable.js +1 -1
- package/dist/m365/flow/commands/flow-enable.js +1 -1
- package/dist/m365/flow/commands/flow-export.js +17 -16
- package/dist/m365/flow/commands/flow-get.js +1 -1
- package/dist/m365/flow/commands/flow-list.js +1 -1
- package/dist/m365/flow/commands/flow-remove.js +1 -1
- package/dist/m365/flow/commands/owner/owner-ensure.js +1 -1
- package/dist/m365/flow/commands/owner/owner-list.js +1 -1
- package/dist/m365/flow/commands/owner/owner-remove.js +1 -1
- package/dist/m365/flow/commands/run/run-cancel.js +1 -1
- package/dist/m365/flow/commands/run/run-get.js +1 -1
- package/dist/m365/flow/commands/run/run-list.js +1 -1
- package/dist/m365/flow/commands/run/run-resubmit.js +2 -2
- package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +8 -8
- package/dist/m365/spo/commands/contenttype/contenttype-field-set.js +2 -2
- package/dist/m365/spo/commands/file/file-roleassignment-add.js +17 -54
- package/dist/m365/spo/commands/file/file-roleassignment-remove.js +13 -40
- package/dist/m365/spo/commands/file/file-roleinheritance-break.js +5 -13
- package/dist/m365/spo/commands/file/file-roleinheritance-reset.js +5 -13
- package/dist/m365/spo/commands/list/list-get.js +17 -4
- package/dist/m365/spo/commands/page/page-section-add.js +185 -34
- package/dist/settingsNames.js +6 -1
- package/dist/utils/entraApp.js +283 -0
- package/dist/utils/spo.js +30 -7
- package/docs/docs/_clisettings.mdx +6 -1
- package/docs/docs/cmd/setup.mdx +17 -6
- package/docs/docs/cmd/spo/contenttype/contenttype-field-remove.mdx +7 -7
- package/docs/docs/cmd/spo/contenttype/contenttype-field-set.mdx +2 -2
- package/docs/docs/cmd/spo/page/page-section-add.mdx +57 -2
- package/package.json +1 -1
package/dist/utils/spo.js
CHANGED
|
@@ -500,10 +500,10 @@ export const spo = {
|
|
|
500
500
|
* @param webUrl Web url
|
|
501
501
|
* @param email The email of the user
|
|
502
502
|
* @param logger the Logger object
|
|
503
|
-
* @param verbose set
|
|
503
|
+
* @param verbose set for verbose logging
|
|
504
504
|
*/
|
|
505
505
|
async getUserByEmail(webUrl, email, logger, verbose) {
|
|
506
|
-
if (verbose) {
|
|
506
|
+
if (verbose && logger) {
|
|
507
507
|
await logger.logToStderr(`Retrieving the spo user by email ${email}`);
|
|
508
508
|
}
|
|
509
509
|
const requestUrl = `${webUrl}/_api/web/siteusers/GetByEmail('${formatting.encodeQueryParameter(email)}')`;
|
|
@@ -574,10 +574,10 @@ export const spo = {
|
|
|
574
574
|
* @param webUrl Web url
|
|
575
575
|
* @param name The name of the group
|
|
576
576
|
* @param logger the Logger object
|
|
577
|
-
* @param verbose set
|
|
577
|
+
* @param verbose set for verbose logging
|
|
578
578
|
*/
|
|
579
579
|
async getGroupByName(webUrl, name, logger, verbose) {
|
|
580
|
-
if (verbose) {
|
|
580
|
+
if (verbose && logger) {
|
|
581
581
|
await logger.logToStderr(`Retrieving the group by name ${name}`);
|
|
582
582
|
}
|
|
583
583
|
const requestUrl = `${webUrl}/_api/web/sitegroups/GetByName('${formatting.encodeQueryParameter(name)}')`;
|
|
@@ -596,10 +596,10 @@ export const spo = {
|
|
|
596
596
|
* @param webUrl Web url
|
|
597
597
|
* @param name the name of the role definition
|
|
598
598
|
* @param logger the Logger object
|
|
599
|
-
* @param
|
|
599
|
+
* @param verbose set for verbose logging
|
|
600
600
|
*/
|
|
601
|
-
async getRoleDefinitionByName(webUrl, name, logger,
|
|
602
|
-
if (
|
|
601
|
+
async getRoleDefinitionByName(webUrl, name, logger, verbose) {
|
|
602
|
+
if (verbose && logger) {
|
|
603
603
|
await logger.logToStderr(`Retrieving the role definitions for ${name}`);
|
|
604
604
|
}
|
|
605
605
|
const roledefinitions = await odata.getAllItems(`${webUrl}/_api/web/roledefinitions`);
|
|
@@ -1527,6 +1527,29 @@ export const spo = {
|
|
|
1527
1527
|
const itemsResponse = await request.get(requestOptionsItems);
|
|
1528
1528
|
return (itemsResponse);
|
|
1529
1529
|
},
|
|
1530
|
+
/**
|
|
1531
|
+
* Retrieves the file by id.
|
|
1532
|
+
* Returns a FileProperties object
|
|
1533
|
+
* @param webUrl Web url
|
|
1534
|
+
* @param id the id of the file
|
|
1535
|
+
* @param logger the Logger object
|
|
1536
|
+
* @param verbose set for verbose logging
|
|
1537
|
+
*/
|
|
1538
|
+
async getFileById(webUrl, id, logger, verbose) {
|
|
1539
|
+
if (verbose && logger) {
|
|
1540
|
+
await logger.logToStderr(`Retrieving the file with id ${id}`);
|
|
1541
|
+
}
|
|
1542
|
+
const requestUrl = `${webUrl}/_api/web/GetFileById('${formatting.encodeQueryParameter(id)}')`;
|
|
1543
|
+
const requestOptions = {
|
|
1544
|
+
url: requestUrl,
|
|
1545
|
+
headers: {
|
|
1546
|
+
'accept': 'application/json;odata=nometadata'
|
|
1547
|
+
},
|
|
1548
|
+
responseType: 'json'
|
|
1549
|
+
};
|
|
1550
|
+
const file = await request.get(requestOptions);
|
|
1551
|
+
return file;
|
|
1552
|
+
},
|
|
1530
1553
|
/**
|
|
1531
1554
|
* Create a SharePoint copy job to copy a file/folder to another location.
|
|
1532
1555
|
* @param webUrl Absolute web URL where the source file/folder is located.
|
|
@@ -2,6 +2,11 @@ Setting name|Definition|Default value
|
|
|
2
2
|
------------|----------|-------------
|
|
3
3
|
`authType`|Default login method to use when running `m365 login` without the `--authType` option.|`deviceCode`
|
|
4
4
|
`autoOpenLinksInBrowser`|Automatically open the browser for all commands which return a url and expect the user to copy paste this to the browser. For example when logging in, using `m365 login` in device code mode.|`false`
|
|
5
|
+
`clientId`|ID of the default Entra ID app use by the CLI to authenticate|``
|
|
6
|
+
`clientSecret`|Secret of the default Entra ID app use by the CLI to authenticate|``
|
|
7
|
+
`clientCertificateFile`|Path to the file containing the client certificate to use for authentication|``
|
|
8
|
+
`clientCertificateBase64Encoded`|Base64-encoded client certificate contents|``
|
|
9
|
+
`clientCertificatePassword`|Password to the client certificate file|``
|
|
5
10
|
`copyDeviceCodeToClipboard`|Automatically copy the device code to the clipboard when running `m365 login` command in device code mode|`false`
|
|
6
11
|
`csvEscape`|Single character used for escaping; only apply to characters matching the quote and the escape options|`"`
|
|
7
12
|
`csvHeader`|Display the column names on the first line|`true`
|
|
@@ -17,4 +22,4 @@ Setting name|Definition|Default value
|
|
|
17
22
|
`prompt`|Prompts for missing values in required options and enables interactive selection when multiple values are available for a command that requires a specific value to be retrieved.|`true`
|
|
18
23
|
`promptListPageSize`|By default, lists of choices longer than 7 will be paginated. Use this option to control how many choices will appear on the screen at once.|7
|
|
19
24
|
`showHelpOnFailure`|Automatically display help when executing a command failed|`true`
|
|
20
|
-
`
|
|
25
|
+
`tenantId`|ID of the default tenant to use when authenticating with|``
|
package/docs/docs/cmd/setup.mdx
CHANGED
|
@@ -18,6 +18,9 @@ m365 setup [options]
|
|
|
18
18
|
|
|
19
19
|
`--scripting`
|
|
20
20
|
: Configure CLI for Microsoft 365 for use in scripts without prompting for additional information.
|
|
21
|
+
|
|
22
|
+
`--skipApp`
|
|
23
|
+
: Skip configuring an Entra app for use with CLI for Microsoft 365.
|
|
21
24
|
```
|
|
22
25
|
|
|
23
26
|
<Global />
|
|
@@ -28,9 +31,13 @@ The `m365 setup` command is a wizard that helps you configure the CLI for Micros
|
|
|
28
31
|
|
|
29
32
|
The command will ask you the following questions:
|
|
30
33
|
|
|
34
|
+
- _CLI for Microsoft 365 requires a Microsoft Entra app. Do you want to create a new app registration or use an existing one?_
|
|
35
|
+
|
|
36
|
+
You can choose between using an existing Entra app or creating a new one. If you choose to create a new app, the CLI will ask you to choose between a minimal and a full set of permissions. It then signs in as Azure CLI to your tenant, creates a new app registration, and stores its information in the CLI configuration.
|
|
37
|
+
|
|
31
38
|
- _How do you plan to use the CLI?_
|
|
32
39
|
|
|
33
|
-
You can choose between **interactive** and **scripting** use. In interactive mode, the CLI for Microsoft 365 will prompt you for additional information when needed, automatically open links browser, automatically show help on errors
|
|
40
|
+
You can choose between **interactive** and **scripting** use. In interactive mode, the CLI for Microsoft 365 will prompt you for additional information when needed, automatically open links browser, automatically show help on errors. In **scripting** mode, the CLI will not use interactivity to prevent blocking your scripts.
|
|
34
41
|
|
|
35
42
|
- _Are you going to use the CLI in PowerShell?_ (asked only when you chose to configure CLI for scripting)
|
|
36
43
|
|
|
@@ -53,7 +60,6 @@ The `m365 setup` command uses the following presets:
|
|
|
53
60
|
- printErrorsAsPlainText: true,
|
|
54
61
|
- prompt: true,
|
|
55
62
|
- showHelpOnFailure: true,
|
|
56
|
-
- showSpinner: true
|
|
57
63
|
- scripting use:
|
|
58
64
|
- autoOpenLinksInBrowser: false,
|
|
59
65
|
- copyDeviceCodeToClipboard: false,
|
|
@@ -61,7 +67,6 @@ The `m365 setup` command uses the following presets:
|
|
|
61
67
|
- printErrorsAsPlainText: false,
|
|
62
68
|
- prompt: false,
|
|
63
69
|
- showHelpOnFailure: false,
|
|
64
|
-
- showSpinner: false
|
|
65
70
|
- use in PowerShell:
|
|
66
71
|
- errorOutput: 'stdout'
|
|
67
72
|
- beginner:
|
|
@@ -71,24 +76,30 @@ The `m365 setup` command uses the following presets:
|
|
|
71
76
|
|
|
72
77
|
## Examples
|
|
73
78
|
|
|
74
|
-
Configure CLI for Microsoft based on your preferences interactively
|
|
79
|
+
Configure CLI for Microsoft 365 based on your preferences interactively
|
|
75
80
|
|
|
76
81
|
```sh
|
|
77
82
|
m365 setup
|
|
78
83
|
```
|
|
79
84
|
|
|
80
|
-
Configure CLI for Microsoft for interactive use without prompting for additional information
|
|
85
|
+
Configure CLI for Microsoft 365 for interactive use without prompting for additional information
|
|
81
86
|
|
|
82
87
|
```sh
|
|
83
88
|
m365 setup --interactive
|
|
84
89
|
```
|
|
85
90
|
|
|
86
|
-
Configure CLI for Microsoft for use in scripts without prompting for additional information
|
|
91
|
+
Configure CLI for Microsoft 365 for use in scripts without prompting for additional information
|
|
87
92
|
|
|
88
93
|
```sh
|
|
89
94
|
m365 setup --scripting
|
|
90
95
|
```
|
|
91
96
|
|
|
97
|
+
Configure CLI for Microsoft 365 without setting up an Entra app
|
|
98
|
+
|
|
99
|
+
```sh
|
|
100
|
+
m365 setup --skipApp
|
|
101
|
+
```
|
|
102
|
+
|
|
92
103
|
## Response
|
|
93
104
|
|
|
94
105
|
The command won't return a response on success.
|
|
@@ -25,10 +25,10 @@ m365 spo contenttype field remove [options]
|
|
|
25
25
|
`--listUrl [listUrl]`
|
|
26
26
|
: Server- or site-relative URL of the list (if it is a list content type). Specify either `listTitle`, `listId` or `listUrl`.
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
`--contentTypeId <contentTypeId>`
|
|
29
29
|
: The ID of the content type to remove the column from.
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
`-i, --id <id>`
|
|
32
32
|
: The ID of the column to remove.
|
|
33
33
|
|
|
34
34
|
`-c, --updateChildContentTypes`
|
|
@@ -45,31 +45,31 @@ m365 spo contenttype field remove [options]
|
|
|
45
45
|
Remove column with a specific ID from a content type with a specific ID from a specific site.
|
|
46
46
|
|
|
47
47
|
```sh
|
|
48
|
-
m365 spo contenttype field remove --contentTypeId "0x0100CA0FA0F5DAEF784494B9C6020C3020A6" --
|
|
48
|
+
m365 spo contenttype field remove --contentTypeId "0x0100CA0FA0F5DAEF784494B9C6020C3020A6" --id "880d2f46-fccb-43ca-9def-f88e722cef80" --webUrl https://contoso.sharepoint.com --force
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
Remove column with a specific ID from a content type with a specific ID from a specific site and updating the child content types.
|
|
52
52
|
|
|
53
53
|
```sh
|
|
54
|
-
m365 spo contenttype field remove --contentTypeId "0x0100CA0FA0F5DAEF784494B9C6020C3020A6" --
|
|
54
|
+
m365 spo contenttype field remove --contentTypeId "0x0100CA0FA0F5DAEF784494B9C6020C3020A6" --id "880d2f46-fccb-43ca-9def-f88e722cef80" --webUrl https://contoso.sharepoint.com --updateChildContentTypes
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
Remove fieldLink with a specific ID from a list (obtained by Title) content type with a specific ID on a specific site.
|
|
58
58
|
|
|
59
59
|
```sh
|
|
60
|
-
m365 spo contenttype field remove --contentTypeId "0x0100CA0FA0F5DAEF784494B9C6020C3020A60062F089A38C867747942DB2C3FC50FF6A" --
|
|
60
|
+
m365 spo contenttype field remove --contentTypeId "0x0100CA0FA0F5DAEF784494B9C6020C3020A60062F089A38C867747942DB2C3FC50FF6A" --id "880d2f46-fccb-43ca-9def-f88e722cef80" --webUrl https://contoso.sharepoint.com --listTitle "Documents"
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
Remove fieldLink with a specific ID from a list (obtained by ID) content type with a specific ID on a specific site.
|
|
64
64
|
|
|
65
65
|
```sh
|
|
66
|
-
m365 spo contenttype field remove --contentTypeId "0x0100CA0FA0F5DAEF784494B9C6020C3020A60062F089A38C867747942DB2C3FC50FF6A" --
|
|
66
|
+
m365 spo contenttype field remove --contentTypeId "0x0100CA0FA0F5DAEF784494B9C6020C3020A60062F089A38C867747942DB2C3FC50FF6A" --id "880d2f46-fccb-43ca-9def-f88e722cef80" --webUrl https://contoso.sharepoint.com --listId "8c7a0fcd-9d64-4634-85ea-ce2b37b2ec0c"
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
Remove fieldLink with a specific ID from a list (obtained by URL) content type with a specific ID on a specific site.
|
|
70
70
|
|
|
71
71
|
```sh
|
|
72
|
-
m365 spo contenttype field remove --contentTypeId "0x0100CA0FA0F5DAEF784494B9C6020C3020A60062F089A38C867747942DB2C3FC50FF6A" --
|
|
72
|
+
m365 spo contenttype field remove --contentTypeId "0x0100CA0FA0F5DAEF784494B9C6020C3020A60062F089A38C867747942DB2C3FC50FF6A" --id "880d2f46-fccb-43ca-9def-f88e722cef80" --webUrl https://contoso.sharepoint.com --listUrl "/shared documents"
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
## Response
|
|
@@ -16,10 +16,10 @@ m365 spo contenttype field set [options]
|
|
|
16
16
|
`-u, --webUrl <webUrl>`
|
|
17
17
|
: Absolute URL of the site where the content type is located.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
`--contentTypeId <contentTypeId>`
|
|
20
20
|
: ID of the content type on which the field reference should be set.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
`-i, --id <id>`
|
|
23
23
|
: ID of the field to which the reference should be set.
|
|
24
24
|
|
|
25
25
|
`-r, --required [required]`
|
|
@@ -26,10 +26,46 @@ m365 spo page section add [options]
|
|
|
26
26
|
: Order of the section to add.
|
|
27
27
|
|
|
28
28
|
`--zoneEmphasis [zoneEmphasis]`
|
|
29
|
-
: Section background shading. Allowed values `None`, `Neutral`, `Soft`, `Strong`
|
|
29
|
+
: Section background shading. Allowed values `None`, `Neutral`, `Soft`, `Strong`, `Image`,`Gradient`
|
|
30
30
|
|
|
31
31
|
`--isLayoutReflowOnTop`
|
|
32
|
-
: The position of the Vertical section for smaller screens. Applied only for Vertical section.
|
|
32
|
+
: The position of the Vertical section for smaller screens. Applied only for `Vertical` section.
|
|
33
|
+
|
|
34
|
+
`--isCollapsibleSection`
|
|
35
|
+
: Set section to be collapsible.
|
|
36
|
+
|
|
37
|
+
`--showDivider`
|
|
38
|
+
: Shows a divider line between sections.
|
|
39
|
+
|
|
40
|
+
`--iconAlignment [iconAlignment]`
|
|
41
|
+
: Specifies the alignment of the expand/collapse icon. Sets `Left` alignment if not specified.
|
|
42
|
+
|
|
43
|
+
`--isExpanded`
|
|
44
|
+
: Sets the default display state of the collapsible section. Sets `false` if not specified.
|
|
45
|
+
|
|
46
|
+
`--gradientText [gradientText]`
|
|
47
|
+
: Sets the gradient setting of the background of a section. Required when `zoneEmphasis` is `Gradient`.
|
|
48
|
+
|
|
49
|
+
`--imageUrl [imageUrl]`
|
|
50
|
+
: The background image URL. Required when `zoneEmphasis` is `Image`.
|
|
51
|
+
|
|
52
|
+
`--imageHeight [imageHeight]`
|
|
53
|
+
: The height of the background image. Applied only when when `zoneEmphasis` is `Image`. Sets `955` value if not specified.
|
|
54
|
+
|
|
55
|
+
`--imageWidth [imageWidth]`
|
|
56
|
+
: The width of the background image. Applied only when `zoneEmphasis` is `Image`. Sets `555` value if not specified.
|
|
57
|
+
|
|
58
|
+
`--fillMode [fillMode]`
|
|
59
|
+
: The fill mode of the background image. Applied only when `zoneEmphasis` is `Image`. Possible values are `ScaleToFill`, `ScaleToFit`, `Tile`, `OriginalSize`. Sets `ScaleToFill` value if not specified.
|
|
60
|
+
|
|
61
|
+
`--useLightText`
|
|
62
|
+
: Specifies whether to use light text for the background. Applied only when `zoneEmphasis` is `Image`.
|
|
63
|
+
|
|
64
|
+
`--overlayColor [overlayColor]`
|
|
65
|
+
: The overlay color for the background in #RRGGBB format. Applied only when `zoneEmphasis` is `Image` or `Gradient`. Sets `#ffffff` value if not specified.
|
|
66
|
+
|
|
67
|
+
`--overlayOpacity [overlayOpacity]`
|
|
68
|
+
: The overlay opacity for the background. Applied only when `zoneEmphasis` is `Image` or `Gradient`. Sets `60` value if not specified.
|
|
33
69
|
```
|
|
34
70
|
|
|
35
71
|
<Global />
|
|
@@ -64,6 +100,25 @@ Add Vertical section with background shading to the modern page with adjusting t
|
|
|
64
100
|
m365 spo page section add --pageName home.aspx --webUrl https://contoso.sharepoint.com/sites/newsletter --sectionTemplate Vertical --zoneEmphasis Neutral --isLayoutReflowOnTop
|
|
65
101
|
```
|
|
66
102
|
|
|
103
|
+
Add OneColumn section as a collapsible section as expanded with icon alligned to the left
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
m365 spo page section add --pageName home.aspx --webUrl https://contoso.sharepoint.com/sites/newsletter --sectionTemplate OneColumn --isCollapsibleSection --isExpanded --iconAlignment Left
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Add TwoColumn section with Image background
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
m365 spo page section add --pageName home.aspx --webUrl https://contoso.sharepoint.com/sites/newsletter --sectionTemplate TwoColumn --imageUrl "https://contoso.com/image.jpg" --zoneEmphasis Image --fillMode Tile
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Add OneColumn section with Gradient background
|
|
116
|
+
|
|
117
|
+
```sh
|
|
118
|
+
m365 spo page section add --pageName home.aspx --webUrl https://contoso.sharepoint.com/sites/newsletter --sectionTemplate TwoColumn --zoneEmphasis Gradient --gradientText "linear-gradient(72.44deg, #E6FBFE 0%, #EDDDFB 100%)"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
|
|
67
122
|
## Response
|
|
68
123
|
|
|
69
124
|
The command won't return a response on success.
|
package/package.json
CHANGED