@pnp/cli-microsoft365 4.2.0 → 4.3.0-beta.014ebf5
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.js +1 -0
- package/dist/m365/aad/commands/app/app-get.js +97 -0
- package/dist/m365/aad/commands.js +1 -0
- package/dist/m365/search/commands/externalconnection/externalconnection-add.js +99 -0
- package/dist/m365/search/commands.js +7 -0
- package/dist/m365/spo/commands/web/web-installedlanguage-list.js +48 -0
- package/dist/m365/spo/commands.js +1 -0
- package/docs/docs/cmd/aad/app/app-get.md +48 -0
- package/docs/docs/cmd/search/externalconnection/externalconnection-add.md +43 -0
- package/docs/docs/cmd/spo/web/web-installedlanguage-list.md +24 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +3 -2
package/.eslintrc.js
CHANGED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const request_1 = require("../../../../request");
|
|
4
|
+
const Utils_1 = require("../../../../Utils");
|
|
5
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
6
|
+
const commands_1 = require("../../commands");
|
|
7
|
+
class AadAppGetCommand extends GraphCommand_1.default {
|
|
8
|
+
get name() {
|
|
9
|
+
return commands_1.default.APP_GET;
|
|
10
|
+
}
|
|
11
|
+
get description() {
|
|
12
|
+
return 'Gets an Azure AD app registration';
|
|
13
|
+
}
|
|
14
|
+
getTelemetryProperties(args) {
|
|
15
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
16
|
+
telemetryProps.appId = typeof args.options.appId !== 'undefined';
|
|
17
|
+
telemetryProps.objectId = typeof args.options.objectId !== 'undefined';
|
|
18
|
+
telemetryProps.name = typeof args.options.name !== 'undefined';
|
|
19
|
+
return telemetryProps;
|
|
20
|
+
}
|
|
21
|
+
commandAction(logger, args, cb) {
|
|
22
|
+
this
|
|
23
|
+
.getAppObjectId(args)
|
|
24
|
+
.then((appObjectId) => {
|
|
25
|
+
const requestOptions = {
|
|
26
|
+
url: `${this.resource}/v1.0/myorganization/applications/${appObjectId}`,
|
|
27
|
+
headers: {
|
|
28
|
+
accept: 'application/json;odata.metadata=none'
|
|
29
|
+
},
|
|
30
|
+
responseType: 'json'
|
|
31
|
+
};
|
|
32
|
+
return request_1.default.get(requestOptions);
|
|
33
|
+
})
|
|
34
|
+
.then((res) => {
|
|
35
|
+
logger.log(res);
|
|
36
|
+
cb();
|
|
37
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
38
|
+
}
|
|
39
|
+
getAppObjectId(args) {
|
|
40
|
+
if (args.options.objectId) {
|
|
41
|
+
return Promise.resolve(args.options.objectId);
|
|
42
|
+
}
|
|
43
|
+
const { appId, name } = args.options;
|
|
44
|
+
const filter = appId ?
|
|
45
|
+
`appId eq '${encodeURIComponent(appId)}'` :
|
|
46
|
+
`displayName eq '${encodeURIComponent(name)}'`;
|
|
47
|
+
const requestOptions = {
|
|
48
|
+
url: `${this.resource}/v1.0/myorganization/applications?$filter=${filter}&$select=id`,
|
|
49
|
+
headers: {
|
|
50
|
+
accept: 'application/json;odata.metadata=none'
|
|
51
|
+
},
|
|
52
|
+
responseType: 'json'
|
|
53
|
+
};
|
|
54
|
+
return request_1.default
|
|
55
|
+
.get(requestOptions)
|
|
56
|
+
.then((res) => {
|
|
57
|
+
if (res.value.length === 1) {
|
|
58
|
+
return Promise.resolve(res.value[0].id);
|
|
59
|
+
}
|
|
60
|
+
if (res.value.length === 0) {
|
|
61
|
+
const applicationIdentifier = appId ? `ID ${appId}` : `name ${name}`;
|
|
62
|
+
return Promise.reject(`No Azure AD application registration with ${applicationIdentifier} found`);
|
|
63
|
+
}
|
|
64
|
+
return Promise.reject(`Multiple Azure AD application registration with name ${name} found. Please disambiguate (app object IDs): ${res.value.map(a => a.id).join(', ')}`);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
options() {
|
|
68
|
+
const options = [
|
|
69
|
+
{ option: '--appId [appId]' },
|
|
70
|
+
{ option: '--objectId [objectId]' },
|
|
71
|
+
{ option: '--name [name]' }
|
|
72
|
+
];
|
|
73
|
+
const parentOptions = super.options();
|
|
74
|
+
return options.concat(parentOptions);
|
|
75
|
+
}
|
|
76
|
+
validate(args) {
|
|
77
|
+
if (!args.options.appId &&
|
|
78
|
+
!args.options.objectId &&
|
|
79
|
+
!args.options.name) {
|
|
80
|
+
return 'Specify either appId, objectId, or name';
|
|
81
|
+
}
|
|
82
|
+
if ((args.options.appId && args.options.objectId) ||
|
|
83
|
+
(args.options.appId && args.options.name) ||
|
|
84
|
+
(args.options.objectId && args.options.name)) {
|
|
85
|
+
return 'Specify either appId, objectId, or name but not both';
|
|
86
|
+
}
|
|
87
|
+
if (args.options.appId && !Utils_1.default.isValidGuid(args.options.appId)) {
|
|
88
|
+
return `${args.options.appId} is not a valid GUID`;
|
|
89
|
+
}
|
|
90
|
+
if (args.options.objectId && !Utils_1.default.isValidGuid(args.options.objectId)) {
|
|
91
|
+
return `${args.options.objectId} is not a valid GUID`;
|
|
92
|
+
}
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
module.exports = new AadAppGetCommand();
|
|
97
|
+
//# sourceMappingURL=app-get.js.map
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const prefix = 'aad';
|
|
4
4
|
exports.default = {
|
|
5
5
|
APP_ADD: `${prefix} app add`,
|
|
6
|
+
APP_GET: `${prefix} app get`,
|
|
6
7
|
APP_SET: `${prefix} app set`,
|
|
7
8
|
APP_ROLE_ADD: `${prefix} app role add`,
|
|
8
9
|
APP_ROLE_LIST: `${prefix} app role list`,
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const request_1 = require("../../../../request");
|
|
4
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
5
|
+
const commands_1 = require("../../commands");
|
|
6
|
+
class SearchExternalConnectionAddCommand extends GraphCommand_1.default {
|
|
7
|
+
get name() {
|
|
8
|
+
return commands_1.default.EXTERNALCONNECTION_ADD;
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return 'Adds a new External Connection for Microsoft Search';
|
|
12
|
+
}
|
|
13
|
+
getTelemetryProperties(args) {
|
|
14
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
15
|
+
telemetryProps.authorizedAppIds = typeof args.options.authorizedAppIds !== undefined;
|
|
16
|
+
return telemetryProps;
|
|
17
|
+
}
|
|
18
|
+
commandAction(logger, args, cb) {
|
|
19
|
+
let appIds = [];
|
|
20
|
+
if (args.options.authorizedAppIds !== undefined &&
|
|
21
|
+
args.options.authorizedAppIds !== '') {
|
|
22
|
+
appIds = args.options.authorizedAppIds.split(',');
|
|
23
|
+
}
|
|
24
|
+
const commandData = {
|
|
25
|
+
id: args.options.id,
|
|
26
|
+
name: args.options.name,
|
|
27
|
+
description: args.options.description,
|
|
28
|
+
configuration: {
|
|
29
|
+
authorizedAppIds: appIds
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const requestOptions = {
|
|
33
|
+
url: `${this.resource}/v1.0/external/connections`,
|
|
34
|
+
headers: {
|
|
35
|
+
accept: 'application/json;odata.metadata=none'
|
|
36
|
+
},
|
|
37
|
+
responseType: 'json',
|
|
38
|
+
data: commandData
|
|
39
|
+
};
|
|
40
|
+
request_1.default
|
|
41
|
+
.post(requestOptions)
|
|
42
|
+
.then(_ => cb(), err => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
43
|
+
}
|
|
44
|
+
options() {
|
|
45
|
+
const options = [
|
|
46
|
+
{
|
|
47
|
+
option: '-i, --id <id>'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
option: '-n, --name <name>'
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
option: '-d, --description <description>'
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
option: '--authorizedAppIds [authorizedAppIds]'
|
|
57
|
+
}
|
|
58
|
+
];
|
|
59
|
+
const parentOptions = super.options();
|
|
60
|
+
return options.concat(parentOptions);
|
|
61
|
+
}
|
|
62
|
+
validate(args) {
|
|
63
|
+
const id = args.options.id;
|
|
64
|
+
if (id.length < 3 || id.length > 32) {
|
|
65
|
+
return 'ID must be between 3 and 32 characters in length.';
|
|
66
|
+
}
|
|
67
|
+
const alphaNumericRegEx = /[^\w]|_/g;
|
|
68
|
+
if (alphaNumericRegEx.test(id)) {
|
|
69
|
+
return 'ID must only contain alphanumeric characters.';
|
|
70
|
+
}
|
|
71
|
+
if (id.length > 9 &&
|
|
72
|
+
id.startsWith('Microsoft')) {
|
|
73
|
+
return 'ID cannot begin with Microsoft';
|
|
74
|
+
}
|
|
75
|
+
const invalidIds = ['None',
|
|
76
|
+
'Directory',
|
|
77
|
+
'Exchange',
|
|
78
|
+
'ExchangeArchive',
|
|
79
|
+
'LinkedIn',
|
|
80
|
+
'Mailbox',
|
|
81
|
+
'OneDriveBusiness',
|
|
82
|
+
'SharePoint',
|
|
83
|
+
'Teams',
|
|
84
|
+
'Yammer',
|
|
85
|
+
'Connectors',
|
|
86
|
+
'TaskFabric',
|
|
87
|
+
'PowerBI',
|
|
88
|
+
'Assistant',
|
|
89
|
+
'TopicEngine',
|
|
90
|
+
'MSFT_All_Connectors'
|
|
91
|
+
];
|
|
92
|
+
if (invalidIds.indexOf(id) > -1) {
|
|
93
|
+
return `ID cannot be one of the following values: ${invalidIds.join(', ')}.`;
|
|
94
|
+
}
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
module.exports = new SearchExternalConnectionAddCommand();
|
|
99
|
+
//# sourceMappingURL=externalconnection-add.js.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const request_1 = require("../../../../request");
|
|
4
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
5
|
+
const commands_1 = require("../../commands");
|
|
6
|
+
class SpoWebInstalledLanguageListCommand extends SpoCommand_1.default {
|
|
7
|
+
get name() {
|
|
8
|
+
return commands_1.default.WEB_INSTALLEDLANGUAGE_LIST;
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return 'Lists all installed languages on site';
|
|
12
|
+
}
|
|
13
|
+
defaultProperties() {
|
|
14
|
+
return ['DisplayName', 'LanguageTag', 'Lcid'];
|
|
15
|
+
}
|
|
16
|
+
commandAction(logger, args, cb) {
|
|
17
|
+
if (this.verbose) {
|
|
18
|
+
logger.logToStderr(`Retrieving all installed languages on site ${args.options.webUrl}...`);
|
|
19
|
+
}
|
|
20
|
+
const requestOptions = {
|
|
21
|
+
url: `${args.options.webUrl}/_api/web/RegionalSettings/InstalledLanguages`,
|
|
22
|
+
headers: {
|
|
23
|
+
'accept': 'application/json;odata=nometadata'
|
|
24
|
+
},
|
|
25
|
+
responseType: 'json'
|
|
26
|
+
};
|
|
27
|
+
request_1.default
|
|
28
|
+
.get(requestOptions)
|
|
29
|
+
.then((webInstalledLanguageProperties) => {
|
|
30
|
+
logger.log(webInstalledLanguageProperties.Items);
|
|
31
|
+
cb();
|
|
32
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
33
|
+
}
|
|
34
|
+
options() {
|
|
35
|
+
const options = [
|
|
36
|
+
{
|
|
37
|
+
option: '-u, --webUrl <webUrl>'
|
|
38
|
+
}
|
|
39
|
+
];
|
|
40
|
+
const parentOptions = super.options();
|
|
41
|
+
return options.concat(parentOptions);
|
|
42
|
+
}
|
|
43
|
+
validate(args) {
|
|
44
|
+
return SpoCommand_1.default.isValidSharePointUrl(args.options.webUrl);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
module.exports = new SpoWebInstalledLanguageListCommand();
|
|
48
|
+
//# sourceMappingURL=web-installedlanguage-list.js.map
|
|
@@ -246,6 +246,7 @@ exports.default = {
|
|
|
246
246
|
WEB_ADD: `${prefix} web add`,
|
|
247
247
|
WEB_CLIENTSIDEWEBPART_LIST: `${prefix} web clientsidewebpart list`,
|
|
248
248
|
WEB_GET: `${prefix} web get`,
|
|
249
|
+
WEB_INSTALLEDLANGUAGE_LIST: `${prefix} web installedlanguage list`,
|
|
249
250
|
WEB_LIST: `${prefix} web list`,
|
|
250
251
|
WEB_REINDEX: `${prefix} web reindex`,
|
|
251
252
|
WEB_REMOVE: `${prefix} web remove`,
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# aad app get
|
|
2
|
+
|
|
3
|
+
Gets an Azure AD app registration
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
m365 aad app get [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
`--appId [appId]`
|
|
14
|
+
: Application (client) ID of the Azure AD application registration to get. Specify either `appId`, `objectId` or `name`
|
|
15
|
+
|
|
16
|
+
`--objectId [objectId]`
|
|
17
|
+
: Object ID of the Azure AD application registration to get. Specify either `appId`, `objectId` or `name`
|
|
18
|
+
|
|
19
|
+
`--name [name]`
|
|
20
|
+
: Name of the Azure AD application registration to get. Specify either `appId`, `objectId` or `name`
|
|
21
|
+
|
|
22
|
+
--8<-- "docs/cmd/_global.md"
|
|
23
|
+
|
|
24
|
+
## Remarks
|
|
25
|
+
|
|
26
|
+
For best performance use the `objectId` option to reference the Azure AD application registration to update. If you use `appId` or `name`, this command will first need to find the corresponding object ID for that application.
|
|
27
|
+
|
|
28
|
+
If the command finds multiple Azure AD application registrations with the specified app name, it will prompt you to disambiguate which app it should use, listing the discovered object IDs.
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
Get the Azure AD application registration by its app (client) ID
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
m365 aad app get --appId d75be2e1-0204-4f95-857d-51a37cf40be8
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Get the Azure AD application registration by its object ID
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
m365 aad app get --objectId d75be2e1-0204-4f95-857d-51a37cf40be8
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Get the Azure AD application registration by its name
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
m365 aad app get --name "My app"
|
|
48
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# search externalconnection add
|
|
2
|
+
|
|
3
|
+
Add a new external connection to be defined for Microsoft Search
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
m365 search externalconnection add [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
`-i, --id <id>`
|
|
14
|
+
: Developer-provided unique ID of the connection within the Azure Active Directory tenant
|
|
15
|
+
|
|
16
|
+
`-n, --name <name>`
|
|
17
|
+
: The display name of the connection to be displayed in the Microsoft 365 admin center. Maximum length of 128 characters
|
|
18
|
+
|
|
19
|
+
`-d, --description <description>`
|
|
20
|
+
: Description of the connection displayed in the Microsoft 365 admin center
|
|
21
|
+
|
|
22
|
+
`--authorizedAppIds [authorizedAppIds]`
|
|
23
|
+
: Comma-separated collection of application IDs for registered Azure Active Directory apps that are allowed to manage the external connection and to index content in the external connection.
|
|
24
|
+
|
|
25
|
+
--8<-- "docs/cmd/_global.md"
|
|
26
|
+
|
|
27
|
+
## Remarks
|
|
28
|
+
|
|
29
|
+
The `id` must be at least 3 and no more than 32 characters long. It can contain only alphanumeric characters, can't begin with _Microsoft_ and can be any of the following values: *None, Directory, Exchange, ExchangeArchive, LinkedIn, Mailbox, OneDriveBusiness, SharePoint, Teams, Yammer, Connectors, TaskFabric, PowerBI, Assistant, TopicEngine, MSFT_All_Connectors*.
|
|
30
|
+
|
|
31
|
+
## Examples
|
|
32
|
+
|
|
33
|
+
Adds a new external connection with name and description of test
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
m365 search externalconnection add --id MyApp --name "My application" --description "Description of your application"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Adds a new external connection with a limited number of authorized apps
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
m365 search externalconnection add --id MyApp --name "My application" --description "Description of your application" --authorizedAppIds "00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000002"
|
|
43
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# spo web installedlanguage list
|
|
2
|
+
|
|
3
|
+
Lists all installed languages on site
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
m365 spo web installedlanguage list [options]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
`-u, --webUrl <webUrl>`
|
|
14
|
+
: URL of the site for which to retrieve the list of installed languages
|
|
15
|
+
|
|
16
|
+
--8<-- "docs/cmd/_global.md"
|
|
17
|
+
|
|
18
|
+
## Examples
|
|
19
|
+
|
|
20
|
+
Return all installed languages from site _https://contoso.sharepoint.com/_
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
m365 spo web installedlanguage list --webUrl https://contoso.sharepoint.com
|
|
24
|
+
```
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnp/cli-microsoft365",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@pnp/cli-microsoft365",
|
|
9
|
-
"version": "4.
|
|
9
|
+
"version": "4.3.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@azure/msal-node": "^1.3.2",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnp/cli-microsoft365",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0-beta.014ebf5",
|
|
4
4
|
"description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -122,6 +122,7 @@
|
|
|
122
122
|
"Levert, Sebastien <slevert@outlook.com>",
|
|
123
123
|
"Maillot, Michaël <battosaimykle@gmail.com>",
|
|
124
124
|
"Mastykarz, Waldek <waldek@mastykarz.nl>",
|
|
125
|
+
"McDonnell, Kevin <kevin@mcd79.com>",
|
|
125
126
|
"Menon, Arjun <arjun.umenon@gmail.com>",
|
|
126
127
|
"Moujahid, Abderahman <rags_place@hotmail.com>",
|
|
127
128
|
"Mücklisch, Steve <steve.muecklisch@gmail.com>",
|
|
@@ -219,4 +220,4 @@
|
|
|
219
220
|
"rimraf": "^3.0.2",
|
|
220
221
|
"sinon": "^11.1.2"
|
|
221
222
|
}
|
|
222
|
-
}
|
|
223
|
+
}
|