@pnp/cli-microsoft365 6.4.0-beta.27e599e → 6.4.0-beta.33050ca
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/Command.js
CHANGED
|
@@ -370,7 +370,7 @@ class Command {
|
|
|
370
370
|
if (!value || typeof value !== 'string') {
|
|
371
371
|
return;
|
|
372
372
|
}
|
|
373
|
-
const lowerCaseValue = value.toLowerCase();
|
|
373
|
+
const lowerCaseValue = value.toLowerCase().trim();
|
|
374
374
|
if (lowerCaseValue === '@meid') {
|
|
375
375
|
args.options[option] = accessToken_1.accessToken.getUserIdFromAccessToken(token);
|
|
376
376
|
}
|
|
@@ -13,11 +13,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
13
|
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");
|
|
14
14
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
15
|
};
|
|
16
|
-
var _SpoHomeSiteSetCommand_instances, _SpoHomeSiteSetCommand_initOptions, _SpoHomeSiteSetCommand_initValidators;
|
|
16
|
+
var _SpoHomeSiteSetCommand_instances, _SpoHomeSiteSetCommand_initTelemetry, _SpoHomeSiteSetCommand_initOptions, _SpoHomeSiteSetCommand_initValidators, _SpoHomeSiteSetCommand_initTypes;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const config_1 = require("../../../../config");
|
|
19
18
|
const request_1 = require("../../../../request");
|
|
20
|
-
const formatting_1 = require("../../../../utils/formatting");
|
|
21
19
|
const spo_1 = require("../../../../utils/spo");
|
|
22
20
|
const validation_1 = require("../../../../utils/validation");
|
|
23
21
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
@@ -32,43 +30,63 @@ class SpoHomeSiteSetCommand extends SpoCommand_1.default {
|
|
|
32
30
|
constructor() {
|
|
33
31
|
super();
|
|
34
32
|
_SpoHomeSiteSetCommand_instances.add(this);
|
|
33
|
+
__classPrivateFieldGet(this, _SpoHomeSiteSetCommand_instances, "m", _SpoHomeSiteSetCommand_initTelemetry).call(this);
|
|
35
34
|
__classPrivateFieldGet(this, _SpoHomeSiteSetCommand_instances, "m", _SpoHomeSiteSetCommand_initOptions).call(this);
|
|
36
35
|
__classPrivateFieldGet(this, _SpoHomeSiteSetCommand_instances, "m", _SpoHomeSiteSetCommand_initValidators).call(this);
|
|
36
|
+
__classPrivateFieldGet(this, _SpoHomeSiteSetCommand_instances, "m", _SpoHomeSiteSetCommand_initTypes).call(this);
|
|
37
37
|
}
|
|
38
38
|
commandAction(logger, args) {
|
|
39
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
40
40
|
try {
|
|
41
|
+
if (this.verbose) {
|
|
42
|
+
logger.logToStderr(`Setting the SharePoint home site to: ${args.options.siteUrl}...`);
|
|
43
|
+
logger.logToStderr('Attempting to retrieve the SharePoint admin URL.');
|
|
44
|
+
}
|
|
41
45
|
const spoAdminUrl = yield spo_1.spo.getSpoAdminUrl(logger, this.debug);
|
|
42
|
-
const reqDigest = yield spo_1.spo.getRequestDigest(spoAdminUrl);
|
|
43
46
|
const requestOptions = {
|
|
44
|
-
url: `${spoAdminUrl}/
|
|
47
|
+
url: `${spoAdminUrl}/_api/SPO.Tenant`,
|
|
45
48
|
headers: {
|
|
46
|
-
'
|
|
49
|
+
accept: 'application/json;odata=nometadata',
|
|
50
|
+
'content-Type': 'application/json'
|
|
47
51
|
},
|
|
48
|
-
|
|
52
|
+
responseType: 'json',
|
|
53
|
+
data: {
|
|
54
|
+
sphSiteUrl: args.options.siteUrl
|
|
55
|
+
}
|
|
49
56
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (response.ErrorInfo) {
|
|
54
|
-
throw response.ErrorInfo.ErrorMessage;
|
|
57
|
+
if (args.options.vivaConnectionsDefaultStart !== undefined) {
|
|
58
|
+
requestOptions.url += '/SetSPHSiteWithConfiguration';
|
|
59
|
+
requestOptions.data.configuration = { vivaConnectionsDefaultStart: args.options.vivaConnectionsDefaultStart };
|
|
55
60
|
}
|
|
56
61
|
else {
|
|
57
|
-
|
|
62
|
+
requestOptions.url += '/SetSPHSite';
|
|
58
63
|
}
|
|
64
|
+
const res = yield request_1.default.post(requestOptions);
|
|
65
|
+
logger.log(res.value);
|
|
59
66
|
}
|
|
60
67
|
catch (err) {
|
|
61
|
-
this.
|
|
68
|
+
this.handleRejectedODataJsonPromise(err);
|
|
62
69
|
}
|
|
63
70
|
});
|
|
64
71
|
}
|
|
65
72
|
}
|
|
66
|
-
_SpoHomeSiteSetCommand_instances = new WeakSet(),
|
|
73
|
+
_SpoHomeSiteSetCommand_instances = new WeakSet(), _SpoHomeSiteSetCommand_initTelemetry = function _SpoHomeSiteSetCommand_initTelemetry() {
|
|
74
|
+
this.telemetry.push((args) => {
|
|
75
|
+
Object.assign(this.telemetryProperties, {
|
|
76
|
+
vivaConnectionsDefaultStart: typeof args.options.vivaConnectionsDefaultStart !== 'undefined'
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}, _SpoHomeSiteSetCommand_initOptions = function _SpoHomeSiteSetCommand_initOptions() {
|
|
67
80
|
this.options.unshift({
|
|
68
81
|
option: '-u, --siteUrl <siteUrl>'
|
|
82
|
+
}, {
|
|
83
|
+
option: '--vivaConnectionsDefaultStart [vivaConnectionsDefaultStart]',
|
|
84
|
+
autocomplete: ['true', 'false']
|
|
69
85
|
});
|
|
70
86
|
}, _SpoHomeSiteSetCommand_initValidators = function _SpoHomeSiteSetCommand_initValidators() {
|
|
71
87
|
this.validators.push((args) => __awaiter(this, void 0, void 0, function* () { return validation_1.validation.isValidSharePointUrl(args.options.siteUrl); }));
|
|
88
|
+
}, _SpoHomeSiteSetCommand_initTypes = function _SpoHomeSiteSetCommand_initTypes() {
|
|
89
|
+
this.types.boolean.push('vivaConnectionsDefaultStart');
|
|
72
90
|
};
|
|
73
91
|
module.exports = new SpoHomeSiteSetCommand();
|
|
74
92
|
//# sourceMappingURL=homesite-set.js.map
|
package/dist/utils/validation.js
CHANGED
|
@@ -11,7 +11,7 @@ exports.validation = {
|
|
|
11
11
|
}
|
|
12
12
|
const guidRegEx = new RegExp(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i);
|
|
13
13
|
// verify if the guid is a valid guid. @meid will be replaced in a later stage with the actual user id of the logged in user
|
|
14
|
-
return guidRegEx.test(guid) || guid.
|
|
14
|
+
return guidRegEx.test(guid) || guid.toLowerCase().trim() === '@meid';
|
|
15
15
|
},
|
|
16
16
|
isValidTeamsChannelId(guid) {
|
|
17
17
|
const guidRegEx = new RegExp(/^19:[0-9a-zA-Z-_]+@thread\.(skype|tacv2)$/i);
|
|
@@ -23,7 +23,8 @@ exports.validation = {
|
|
|
23
23
|
},
|
|
24
24
|
isValidUserPrincipalName(upn) {
|
|
25
25
|
const upnRegEx = new RegExp(/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/i);
|
|
26
|
-
|
|
26
|
+
// verify if the upn is a valid upn. @meusername will be replaced in a later stage with the actual username of the logged in user
|
|
27
|
+
return upnRegEx.test(upn) || upn.toLowerCase().trim() === '@meusername';
|
|
27
28
|
},
|
|
28
29
|
isDateInRange(date, monthOffset) {
|
|
29
30
|
const d = new Date(date);
|
|
@@ -11,14 +11,17 @@ m365 spo homesite set [options]
|
|
|
11
11
|
## Options
|
|
12
12
|
|
|
13
13
|
`-u, --siteUrl <siteUrl>`
|
|
14
|
-
: The URL of the site to set as Home
|
|
14
|
+
: The URL of the site to set as Home site.
|
|
15
|
+
|
|
16
|
+
`--vivaConnectionsDefaultStart [vivaConnectionsDefaultStart]`
|
|
17
|
+
: When set to `true`, the Viva Connections landing experience is set to the SharePoint home site. If set to `false`, the Viva Connections home experience will be used.
|
|
15
18
|
|
|
16
19
|
--8<-- "docs/cmd/_global.md"
|
|
17
20
|
|
|
18
21
|
## Remarks
|
|
19
22
|
|
|
20
23
|
!!! important
|
|
21
|
-
To use this command you
|
|
24
|
+
To use this command you must be a Global or SharePoint administrator.
|
|
22
25
|
|
|
23
26
|
## Examples
|
|
24
27
|
|
|
@@ -28,8 +31,22 @@ Set the specified site as the Home Site.
|
|
|
28
31
|
m365 spo homesite set --siteUrl https://contoso.sharepoint.com/sites/comms
|
|
29
32
|
```
|
|
30
33
|
|
|
34
|
+
Sets the Home site to the provided site collection url and sets the Viva Connections landing experience to the SharePoint home site
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
m365 spo homesite set --siteUrl https://contoso.sharepoint.com/sites/comms --vivaConnectionsDefaultStart true
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Sets the Home site to the provided site collection url and sets the Viva Connections landing experience to the default experience
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
m365 spo homesite set --siteUrl https://contoso.sharepoint.com/sites/comms --vivaConnectionsDefaultStart false
|
|
44
|
+
```
|
|
45
|
+
|
|
31
46
|
## Response
|
|
32
47
|
|
|
48
|
+
### Standard response
|
|
49
|
+
|
|
33
50
|
=== "JSON"
|
|
34
51
|
|
|
35
52
|
```json
|
|
@@ -54,6 +71,34 @@ m365 spo homesite set --siteUrl https://contoso.sharepoint.com/sites/comms
|
|
|
54
71
|
The Home site has been set to https://contoso.sharepoint.com. It may take some time for the change to apply. Check aka.ms/homesites for details.
|
|
55
72
|
```
|
|
56
73
|
|
|
74
|
+
### `vivaConnectionsDefaultStart` response
|
|
75
|
+
|
|
76
|
+
When we make use of the option `vivaConnectionsDefaultStart` the response will differ.
|
|
77
|
+
|
|
78
|
+
=== "JSON"
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
"The Home site has been set to https://contoso.sharepoint.com and the Viva Connections default experience to True. It may take some time for the change to apply. Check aka.ms/homesites for details."
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
=== "Text"
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
The Home site has been set to https://contoso.sharepoint.com and the Viva Connections default experience to True. It may take some time for the change to apply. Check aka.ms/homesites for details.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
=== "CSV"
|
|
91
|
+
|
|
92
|
+
```csv
|
|
93
|
+
The Home site has been set to https://contoso.sharepoint.com and the Viva Connections default experience to True. It may take some time for the change to apply. Check aka.ms/homesites for details.
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
=== "Markdown"
|
|
97
|
+
|
|
98
|
+
```md
|
|
99
|
+
The Home site has been set to https://contoso.sharepoint.com and the Viva Connections default experience to True. It may take some time for the change to apply. Check aka.ms/homesites for details.
|
|
100
|
+
```
|
|
101
|
+
|
|
57
102
|
## More information
|
|
58
103
|
|
|
59
104
|
- SharePoint home sites: a landing for your organization on the intelligent intranet: [https://techcommunity.microsoft.com/t5/Microsoft-SharePoint-Blog/SharePoint-home-sites-a-landing-for-your-organization-on-the/ba-p/621933](https://techcommunity.microsoft.com/t5/Microsoft-SharePoint-Blog/SharePoint-home-sites-a-landing-for-your-organization-on-the/ba-p/621933)
|
package/package.json
CHANGED