@pnp/cli-microsoft365 11.3.0-beta.b2b02ae → 11.3.0-beta.c16a3a7
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/m365/onenote/commands/notebook/notebook-add.js +4 -3
- package/dist/m365/onenote/commands/notebook/notebook-list.js +6 -17
- package/dist/m365/onenote/commands/page/page-list.js +5 -8
- package/docs/docs/cmd/login.mdx +35 -11
- package/docs/docs/cmd/onenote/notebook/notebook-add.mdx +17 -0
- package/docs/docs/cmd/onenote/notebook/notebook-list.mdx +17 -0
- package/docs/docs/cmd/onenote/page/page-list.mdx +18 -1
- package/package.json +1 -1
|
@@ -7,10 +7,11 @@ var _OneNoteNotebookAddCommand_instances, _OneNoteNotebookAddCommand_initTelemet
|
|
|
7
7
|
import request from '../../../../request.js';
|
|
8
8
|
import { entraGroup } from '../../../../utils/entraGroup.js';
|
|
9
9
|
import { validation } from '../../../../utils/validation.js';
|
|
10
|
-
import GraphCommand from '../../../base/GraphCommand.js';
|
|
11
10
|
import commands from '../../commands.js';
|
|
12
11
|
import { spo } from '../../../../utils/spo.js';
|
|
13
|
-
|
|
12
|
+
import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
|
|
13
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
14
|
+
class OneNoteNotebookAddCommand extends GraphDelegatedCommand {
|
|
14
15
|
get name() {
|
|
15
16
|
return commands.NOTEBOOK_ADD;
|
|
16
17
|
}
|
|
@@ -55,7 +56,7 @@ class OneNoteNotebookAddCommand extends GraphCommand {
|
|
|
55
56
|
endpoint += `users/${args.options.userId}`;
|
|
56
57
|
}
|
|
57
58
|
else if (args.options.userName) {
|
|
58
|
-
endpoint += `users/${args.options.userName}`;
|
|
59
|
+
endpoint += `users/${formatting.encodeQueryParameter(args.options.userName)}`;
|
|
59
60
|
}
|
|
60
61
|
else if (args.options.groupId) {
|
|
61
62
|
endpoint += `groups/${args.options.groupId}`;
|
|
@@ -4,13 +4,14 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _OneNoteNotebookListCommand_instances, _OneNoteNotebookListCommand_initTelemetry, _OneNoteNotebookListCommand_initOptions, _OneNoteNotebookListCommand_initValidators, _OneNoteNotebookListCommand_initOptionSets;
|
|
7
|
-
import request from '../../../../request.js';
|
|
8
7
|
import { entraGroup } from '../../../../utils/entraGroup.js';
|
|
9
8
|
import { odata } from '../../../../utils/odata.js';
|
|
10
9
|
import { validation } from '../../../../utils/validation.js';
|
|
11
|
-
import GraphCommand from '../../../base/GraphCommand.js';
|
|
12
10
|
import commands from '../../commands.js';
|
|
13
|
-
|
|
11
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
12
|
+
import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
|
|
13
|
+
import { spo } from '../../../../utils/spo.js';
|
|
14
|
+
class OneNoteNotebookListCommand extends GraphDelegatedCommand {
|
|
14
15
|
get name() {
|
|
15
16
|
return commands.NOTEBOOK_LIST;
|
|
16
17
|
}
|
|
@@ -34,7 +35,7 @@ class OneNoteNotebookListCommand extends GraphCommand {
|
|
|
34
35
|
endpoint += `users/${args.options.userId}`;
|
|
35
36
|
}
|
|
36
37
|
else if (args.options.userName) {
|
|
37
|
-
endpoint += `users/${args.options.userName}`;
|
|
38
|
+
endpoint += `users/${formatting.encodeQueryParameter(args.options.userName)}`;
|
|
38
39
|
}
|
|
39
40
|
else if (args.options.groupId) {
|
|
40
41
|
endpoint += `groups/${args.options.groupId}`;
|
|
@@ -44,7 +45,7 @@ class OneNoteNotebookListCommand extends GraphCommand {
|
|
|
44
45
|
endpoint += `groups/${groupId}`;
|
|
45
46
|
}
|
|
46
47
|
else if (args.options.webUrl) {
|
|
47
|
-
const siteId = await
|
|
48
|
+
const siteId = await spo.getSpoGraphSiteId(args.options.webUrl);
|
|
48
49
|
endpoint += `sites/${siteId}`;
|
|
49
50
|
}
|
|
50
51
|
else {
|
|
@@ -57,18 +58,6 @@ class OneNoteNotebookListCommand extends GraphCommand {
|
|
|
57
58
|
const group = await entraGroup.getGroupByDisplayName(groupName);
|
|
58
59
|
return group.id;
|
|
59
60
|
}
|
|
60
|
-
async getSpoSiteId(webUrl) {
|
|
61
|
-
const url = new URL(webUrl);
|
|
62
|
-
const requestOptions = {
|
|
63
|
-
url: `${this.resource}/v1.0/sites/${url.hostname}:${url.pathname}`,
|
|
64
|
-
headers: {
|
|
65
|
-
accept: 'application/json;odata.metadata=none'
|
|
66
|
-
},
|
|
67
|
-
responseType: 'json'
|
|
68
|
-
};
|
|
69
|
-
const site = await request.get(requestOptions);
|
|
70
|
-
return site.id;
|
|
71
|
-
}
|
|
72
61
|
async commandAction(logger, args) {
|
|
73
62
|
try {
|
|
74
63
|
const endpoint = await this.getEndpointUrl(args);
|
|
@@ -8,9 +8,10 @@ import { entraGroup } from '../../../../utils/entraGroup.js';
|
|
|
8
8
|
import { odata } from '../../../../utils/odata.js';
|
|
9
9
|
import { spo } from '../../../../utils/spo.js';
|
|
10
10
|
import { validation } from '../../../../utils/validation.js';
|
|
11
|
-
import GraphCommand from '../../../base/GraphCommand.js';
|
|
12
11
|
import commands from '../../commands.js';
|
|
13
|
-
|
|
12
|
+
import GraphDelegatedCommand from '../../../base/GraphDelegatedCommand.js';
|
|
13
|
+
import { formatting } from '../../../../utils/formatting.js';
|
|
14
|
+
class OneNotePageListCommand extends GraphDelegatedCommand {
|
|
14
15
|
get name() {
|
|
15
16
|
return commands.PAGE_LIST;
|
|
16
17
|
}
|
|
@@ -34,13 +35,13 @@ class OneNotePageListCommand extends GraphCommand {
|
|
|
34
35
|
endpoint += `users/${args.options.userId}`;
|
|
35
36
|
}
|
|
36
37
|
else if (args.options.userName) {
|
|
37
|
-
endpoint += `users/${args.options.userName}`;
|
|
38
|
+
endpoint += `users/${formatting.encodeQueryParameter(args.options.userName)}`;
|
|
38
39
|
}
|
|
39
40
|
else if (args.options.groupId) {
|
|
40
41
|
endpoint += `groups/${args.options.groupId}`;
|
|
41
42
|
}
|
|
42
43
|
else if (args.options.groupName) {
|
|
43
|
-
const groupId = await
|
|
44
|
+
const groupId = await entraGroup.getGroupIdByDisplayName(args.options.groupName);
|
|
44
45
|
endpoint += `groups/${groupId}`;
|
|
45
46
|
}
|
|
46
47
|
else if (args.options.webUrl) {
|
|
@@ -53,10 +54,6 @@ class OneNotePageListCommand extends GraphCommand {
|
|
|
53
54
|
endpoint += '/onenote/pages';
|
|
54
55
|
return endpoint;
|
|
55
56
|
}
|
|
56
|
-
async getGroupId(groupName) {
|
|
57
|
-
const group = await entraGroup.getGroupByDisplayName(groupName);
|
|
58
|
-
return group.id;
|
|
59
|
-
}
|
|
60
57
|
async commandAction(logger, args) {
|
|
61
58
|
try {
|
|
62
59
|
const endpoint = await this.getEndpointUrl(args);
|
package/docs/docs/cmd/login.mdx
CHANGED
|
@@ -118,54 +118,72 @@ Log in to Microsoft 365 using your own Microsoft Entra application and a persona
|
|
|
118
118
|
m365 login --authType certificate --appId 31359c7f-bd7e-475c-86db-fdb8c937548c --tenant 31359c7f-bd7e-475c-86db-fdb8c937548a --certificateFile /Users/user/dev/localhost.pfx --password 'pass@word1'
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
Log in to Microsoft 365 using a user name and password
|
|
121
|
+
Log in to Microsoft 365 using a user name and password by providing the application and tenant identifiers explicitly.
|
|
122
122
|
|
|
123
123
|
```sh
|
|
124
|
-
m365 login --authType password --userName user@contoso.com --password pass@word1
|
|
124
|
+
m365 login --authType password --appId 31359c7f-bd7e-475c-86db-fdb8c937548c --tenant 31359c7f-bd7e-475c-86db-fdb8c937548a --userName user@contoso.com --password pass@word1
|
|
125
125
|
```
|
|
126
126
|
|
|
127
|
-
Log in to Microsoft 365 using a PEM certificate with `
|
|
127
|
+
Log in to Microsoft 365 using a PEM certificate with `CLIMICROSOFT365_ENTRAAPPID` and `CLIMICROSOFT365_TENANT` environment variables set.
|
|
128
128
|
|
|
129
129
|
```sh
|
|
130
130
|
m365 login --authType certificate --certificateFile /Users/user/dev/localhost.pem
|
|
131
131
|
```
|
|
132
132
|
|
|
133
|
-
Log in to Microsoft 365 using a PEM certificate with `
|
|
133
|
+
Log in to Microsoft 365 using a PEM certificate and a specific thumbprint with `CLIMICROSOFT365_ENTRAAPPID` and `CLIMICROSOFT365_TENANT` environment variables set.
|
|
134
134
|
|
|
135
135
|
```sh
|
|
136
|
-
m365 login --authType certificate --certificateFile /Users/user/dev/localhost.pem
|
|
136
|
+
m365 login --authType certificate --certificateFile /Users/user/dev/localhost.pem --thumbprint 47C4885736C624E90491F32B98855AA8A7562AF1
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
-
Log in to Microsoft 365 using a
|
|
139
|
+
Log in to Microsoft 365 using a PEM certificate by providing the application and tenant identifiers explicitly.
|
|
140
|
+
|
|
141
|
+
```sh
|
|
142
|
+
m365 login --authType certificate --appId 31359c7f-bd7e-475c-86db-fdb8c937548c --tenant 31359c7f-bd7e-475c-86db-fdb8c937548a --certificateFile /Users/user/dev/localhost.pem
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Log in to Microsoft 365 using a personal information exchange (.pfx) file with `CLIMICROSOFT365_ENTRAAPPID` and `CLIMICROSOFT365_TENANT` environment variables set.
|
|
140
146
|
|
|
141
147
|
```sh
|
|
142
148
|
m365 login --authType certificate --certificateFile /Users/user/dev/localhost.pfx --password 'pass@word1'
|
|
143
149
|
```
|
|
144
150
|
|
|
145
|
-
Log in to Microsoft 365 using a personal information exchange (.pfx) file protected with an empty password
|
|
151
|
+
Log in to Microsoft 365 using a personal information exchange (.pfx) file protected with an empty password with `CLIMICROSOFT365_ENTRAAPPID` and `CLIMICROSOFT365_TENANT` environment variables set.
|
|
146
152
|
|
|
147
153
|
```sh
|
|
148
154
|
m365 login --authType certificate --certificateFile /Users/user/dev/localhost.pfx --password
|
|
149
155
|
```
|
|
150
156
|
|
|
151
|
-
Log in to Microsoft 365 using a personal information exchange (.pfx) file not protected with a password
|
|
157
|
+
Log in to Microsoft 365 using a personal information exchange (.pfx) file not protected with a password with `CLIMICROSOFT365_ENTRAAPPID` and `CLIMICROSOFT365_TENANT` environment variables set.
|
|
152
158
|
|
|
153
159
|
```sh
|
|
154
160
|
m365 login --authType certificate --certificateFile /Users/user/dev/localhost.pfx
|
|
155
161
|
```
|
|
156
162
|
|
|
157
|
-
Log in to Microsoft 365 using a personal information exchange (.pfx) file
|
|
163
|
+
Log in to Microsoft 365 using a personal information exchange (.pfx) file and a specific thumbprint with `CLIMICROSOFT365_ENTRAAPPID` and `CLIMICROSOFT365_TENANT` environment variables set.
|
|
158
164
|
|
|
159
165
|
```sh
|
|
160
166
|
m365 login --authType certificate --certificateFile /Users/user/dev/localhost.pfx --thumbprint 47C4885736C624E90491F32B98855AA8A7562AF1 --password 'pass@word1'
|
|
161
167
|
```
|
|
162
168
|
|
|
163
|
-
Log in to Microsoft 365 using a
|
|
169
|
+
Log in to Microsoft 365 using a personal information exchange (.pfx) file by providing the application and tenant identifiers explicitly.
|
|
170
|
+
|
|
171
|
+
```sh
|
|
172
|
+
m365 login --authType certificate --appId 31359c7f-bd7e-475c-86db-fdb8c937548c --tenant 31359c7f-bd7e-475c-86db-fdb8c937548a --certificateFile /Users/user/dev/localhost.pfx --password 'pass@word1'
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Log in to Microsoft 365 using a certificate from a base64-encoded string with `CLIMICROSOFT365_ENTRAAPPID` and `CLIMICROSOFT365_TENANT` environment variables set.
|
|
164
176
|
|
|
165
177
|
```sh
|
|
166
178
|
m365 login --authType certificate --certificateBase64Encoded MIII2QIBAzCCCJ8GCSqGSIb3DQEHAaCCCJAEg...eX1N5AgIIAA== --thumbprint D0C9B442DE249F55D10CDA1A2418952DC7D407A3
|
|
167
179
|
```
|
|
168
180
|
|
|
181
|
+
Log in to Microsoft 365 using a certificate from a base64-encoded string by providing the application and tenant identifiers explicitly.
|
|
182
|
+
|
|
183
|
+
```sh
|
|
184
|
+
m365 login --authType certificate --appId 31359c7f-bd7e-475c-86db-fdb8c937548c --tenant 31359c7f-bd7e-475c-86db-fdb8c937548a --certificateBase64Encoded MIII2QIBAzCCCJ8GCSqGSIb3DQEHAaCCCJAEg...eX1N5AgIIAA== --thumbprint D0C9B442DE249F55D10CDA1A2418952DC7D407A3
|
|
185
|
+
```
|
|
186
|
+
|
|
169
187
|
Log in to Microsoft 365 using a system assigned managed identity with `clientId` set in the configuration. Applies to Azure resources with managed identity enabled, such as Azure Virtual Machines, Azure App Service or Azure Functions.
|
|
170
188
|
|
|
171
189
|
```sh
|
|
@@ -196,12 +214,18 @@ Log in to Microsoft 365 using the interactive browser authentication with `clien
|
|
|
196
214
|
m365 login --authType browser
|
|
197
215
|
```
|
|
198
216
|
|
|
199
|
-
Log in to Microsoft 365 using a client secret with `
|
|
217
|
+
Log in to Microsoft 365 using a client secret with `CLIMICROSOFT365_ENTRAAPPID` and `CLIMICROSOFT365_TENANT` environment variables set.
|
|
200
218
|
|
|
201
219
|
```sh
|
|
202
220
|
m365 login --authType secret --secret topSeCr3t@007
|
|
203
221
|
```
|
|
204
222
|
|
|
223
|
+
Log in to Microsoft 365 using a client secret by providing the application and tenant identifiers explicitly.
|
|
224
|
+
|
|
225
|
+
```sh
|
|
226
|
+
m365 login --authType secret --appId 31359c7f-bd7e-475c-86db-fdb8c937548c --tenant 31359c7f-bd7e-475c-86db-fdb8c937548a --secret topSeCr3t@007
|
|
227
|
+
```
|
|
228
|
+
|
|
205
229
|
Ensures that the user is signed in, initiates the login flow if the user isn't signed in
|
|
206
230
|
|
|
207
231
|
```sh
|
|
@@ -36,6 +36,23 @@ m365 onenote notebook add [options]
|
|
|
36
36
|
|
|
37
37
|
<Global />
|
|
38
38
|
|
|
39
|
+
## Permissions
|
|
40
|
+
|
|
41
|
+
<Tabs>
|
|
42
|
+
<TabItem value="Delegated">
|
|
43
|
+
|
|
44
|
+
| Resource | Permissions |
|
|
45
|
+
|-----------------|------------------------------------------------------------------|
|
|
46
|
+
| Microsoft Graph | Notes.Create, Sites.Read.All, User.ReadBasic.All, Group.Read.All |
|
|
47
|
+
|
|
48
|
+
</TabItem>
|
|
49
|
+
<TabItem value="Application">
|
|
50
|
+
|
|
51
|
+
This command does not support application permissions.
|
|
52
|
+
|
|
53
|
+
</TabItem>
|
|
54
|
+
</Tabs>
|
|
55
|
+
|
|
39
56
|
## Examples
|
|
40
57
|
|
|
41
58
|
Create a Microsoft OneNote notebook for the currently logged in user
|
|
@@ -33,6 +33,23 @@ m365 onenote notebook list [options]
|
|
|
33
33
|
|
|
34
34
|
<Global />
|
|
35
35
|
|
|
36
|
+
## Permissions
|
|
37
|
+
|
|
38
|
+
<Tabs>
|
|
39
|
+
<TabItem value="Delegated">
|
|
40
|
+
|
|
41
|
+
| Resource | Permissions |
|
|
42
|
+
|-----------------|--------------------------------------------------------------------|
|
|
43
|
+
| Microsoft Graph | Notes.Read.All, Sites.Read.All, User.ReadBasic.All, Group.Read.All |
|
|
44
|
+
|
|
45
|
+
</TabItem>
|
|
46
|
+
<TabItem value="Application">
|
|
47
|
+
|
|
48
|
+
This command does not support application permissions.
|
|
49
|
+
|
|
50
|
+
</TabItem>
|
|
51
|
+
</Tabs>
|
|
52
|
+
|
|
36
53
|
## Examples
|
|
37
54
|
|
|
38
55
|
List Microsoft OneNote notebooks for the currently logged in user
|
|
@@ -35,7 +35,24 @@ m365 onenote page list [options]
|
|
|
35
35
|
|
|
36
36
|
## Remarks
|
|
37
37
|
|
|
38
|
-
When
|
|
38
|
+
When you don't specify either `userId`, `userName`, `groupId`, `groupName` or `webUrl`, the OneNote pages will be retrieved of the currently logged in user.
|
|
39
|
+
|
|
40
|
+
## Permissions
|
|
41
|
+
|
|
42
|
+
<Tabs>
|
|
43
|
+
<TabItem value="Delegated">
|
|
44
|
+
|
|
45
|
+
| Resource | Permissions |
|
|
46
|
+
|-----------------|--------------------------------------------------------------------|
|
|
47
|
+
| Microsoft Graph | Notes.Read.All, Sites.Read.All, User.ReadBasic.All, Group.Read.All |
|
|
48
|
+
|
|
49
|
+
</TabItem>
|
|
50
|
+
<TabItem value="Application">
|
|
51
|
+
|
|
52
|
+
This command does not support application permissions.
|
|
53
|
+
|
|
54
|
+
</TabItem>
|
|
55
|
+
</Tabs>
|
|
39
56
|
|
|
40
57
|
## Examples
|
|
41
58
|
|
package/package.json
CHANGED