@pnp/cli-microsoft365 9.1.0-beta.4ee36d4 → 9.1.0-beta.94ae9ed
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/m365/base/PowerAutomateCommand.js +1 -1
- 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/recyclebinitem/recyclebinitem-list.js +47 -0
- package/dist/m365/flow/commands/recyclebinitem/recyclebinitem-restore.js +48 -0
- 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/flow/commands.js +2 -0
- 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/folder/folder-sharinglink-add.js +143 -0
- package/dist/m365/spo/commands/folder/folder-sharinglink-clear.js +111 -0
- package/dist/m365/spo/commands/folder/folder-sharinglink-remove.js +95 -0
- 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/m365/spo/commands/site/SiteAdmin.js +2 -0
- package/dist/m365/spo/commands/site/site-admin-add.js +252 -0
- package/dist/m365/spo/commands/site/site-admin-list.js +2 -27
- package/dist/m365/spo/commands/user/user-get.js +67 -9
- package/dist/m365/spo/commands.js +4 -0
- package/dist/m365/spp/commands/contentcenter/contentcenter-list.js +56 -0
- package/dist/m365/spp/commands.js +5 -0
- package/dist/utils/spo.js +75 -7
- package/docs/docs/cmd/flow/recyclebinitem/recyclebinitem-list.mdx +132 -0
- package/docs/docs/cmd/flow/recyclebinitem/recyclebinitem-restore.mdx +55 -0
- package/docs/docs/cmd/spo/folder/folder-sharinglink-add.mdx +125 -0
- package/docs/docs/cmd/spo/folder/folder-sharinglink-clear.mdx +50 -0
- package/docs/docs/cmd/spo/folder/folder-sharinglink-remove.mdx +50 -0
- package/docs/docs/cmd/spo/page/page-section-add.mdx +57 -2
- package/docs/docs/cmd/spo/site/site-admin-add.mdx +67 -0
- package/docs/docs/cmd/spo/user/user-get.mdx +35 -9
- package/docs/docs/cmd/spp/contentcenter/contentcenter-list.mdx +289 -0
- package/package.json +1 -1
|
@@ -3,8 +3,9 @@ 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 _SpoUserGetCommand_instances, _SpoUserGetCommand_initTelemetry, _SpoUserGetCommand_initOptions, _SpoUserGetCommand_initValidators, _SpoUserGetCommand_initOptionSets;
|
|
6
|
+
var _SpoUserGetCommand_instances, _SpoUserGetCommand_initTelemetry, _SpoUserGetCommand_initOptions, _SpoUserGetCommand_initTypes, _SpoUserGetCommand_initValidators, _SpoUserGetCommand_initOptionSets;
|
|
7
7
|
import request from '../../../../request.js';
|
|
8
|
+
import { entraGroup } from '../../../../utils/entraGroup.js';
|
|
8
9
|
import { formatting } from '../../../../utils/formatting.js';
|
|
9
10
|
import { validation } from '../../../../utils/validation.js';
|
|
10
11
|
import SpoCommand from '../../../base/SpoCommand.js';
|
|
@@ -23,23 +24,38 @@ class SpoUserGetCommand extends SpoCommand {
|
|
|
23
24
|
__classPrivateFieldGet(this, _SpoUserGetCommand_instances, "m", _SpoUserGetCommand_initOptions).call(this);
|
|
24
25
|
__classPrivateFieldGet(this, _SpoUserGetCommand_instances, "m", _SpoUserGetCommand_initValidators).call(this);
|
|
25
26
|
__classPrivateFieldGet(this, _SpoUserGetCommand_instances, "m", _SpoUserGetCommand_initOptionSets).call(this);
|
|
27
|
+
__classPrivateFieldGet(this, _SpoUserGetCommand_instances, "m", _SpoUserGetCommand_initTypes).call(this);
|
|
26
28
|
}
|
|
27
29
|
async commandAction(logger, args) {
|
|
28
30
|
if (this.verbose) {
|
|
29
31
|
await logger.logToStderr(`Retrieving information for user in site '${args.options.webUrl}'...`);
|
|
30
32
|
}
|
|
31
|
-
let requestUrl =
|
|
33
|
+
let requestUrl = `${args.options.webUrl}/_api/web/`;
|
|
32
34
|
if (args.options.id) {
|
|
33
|
-
requestUrl
|
|
35
|
+
requestUrl += `siteusers/GetById('${formatting.encodeQueryParameter(args.options.id.toString())}')`;
|
|
34
36
|
}
|
|
35
37
|
else if (args.options.email) {
|
|
36
|
-
requestUrl
|
|
38
|
+
requestUrl += `siteusers/GetByEmail('${formatting.encodeQueryParameter(args.options.email)}')`;
|
|
37
39
|
}
|
|
38
40
|
else if (args.options.loginName) {
|
|
39
|
-
requestUrl
|
|
41
|
+
requestUrl += `siteusers/GetByLoginName('${formatting.encodeQueryParameter(args.options.loginName)}')`;
|
|
42
|
+
}
|
|
43
|
+
else if (args.options.userName) {
|
|
44
|
+
const user = await this.getUser(requestUrl, args.options.userName);
|
|
45
|
+
requestUrl += `siteusers/GetById('${formatting.encodeQueryParameter(user.Id.toString())}')`;
|
|
46
|
+
}
|
|
47
|
+
else if (args.options.entraGroupId || args.options.entraGroupName) {
|
|
48
|
+
const entraGroup = await this.getEntraGroup(args.options.entraGroupId, args.options.entraGroupName);
|
|
49
|
+
// For entra groups, M365 groups have an associated email and security groups don't
|
|
50
|
+
if (entraGroup?.mail) {
|
|
51
|
+
requestUrl += `siteusers/GetByEmail('${formatting.encodeQueryParameter(entraGroup.mail)}')`;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
requestUrl += `siteusers/GetByLoginName('c:0t.c|tenant|${entraGroup?.id}')`;
|
|
55
|
+
}
|
|
40
56
|
}
|
|
41
57
|
else {
|
|
42
|
-
requestUrl
|
|
58
|
+
requestUrl += `currentuser`;
|
|
43
59
|
}
|
|
44
60
|
const requestOptions = {
|
|
45
61
|
url: requestUrl,
|
|
@@ -57,13 +73,38 @@ class SpoUserGetCommand extends SpoCommand {
|
|
|
57
73
|
this.handleRejectedODataJsonPromise(err);
|
|
58
74
|
}
|
|
59
75
|
}
|
|
76
|
+
async getUser(baseUrl, userName) {
|
|
77
|
+
const requestUrl = `${baseUrl}siteusers?$filter=UserPrincipalName eq ('${formatting.encodeQueryParameter(userName)}')`;
|
|
78
|
+
const requestOptions = {
|
|
79
|
+
url: requestUrl,
|
|
80
|
+
headers: {
|
|
81
|
+
accept: 'application/json;odata=nometadata'
|
|
82
|
+
},
|
|
83
|
+
responseType: 'json'
|
|
84
|
+
};
|
|
85
|
+
const userInstance = await request.get(requestOptions);
|
|
86
|
+
const userInstanceValue = userInstance.value[0];
|
|
87
|
+
if (!userInstanceValue) {
|
|
88
|
+
throw `User not found: ${userName}`;
|
|
89
|
+
}
|
|
90
|
+
return userInstanceValue;
|
|
91
|
+
}
|
|
92
|
+
async getEntraGroup(entraGroupId, entraGroupName) {
|
|
93
|
+
if (entraGroupId) {
|
|
94
|
+
return entraGroup.getGroupById(entraGroupId);
|
|
95
|
+
}
|
|
96
|
+
return entraGroup.getGroupByDisplayName(entraGroupName);
|
|
97
|
+
}
|
|
60
98
|
}
|
|
61
99
|
_SpoUserGetCommand_instances = new WeakSet(), _SpoUserGetCommand_initTelemetry = function _SpoUserGetCommand_initTelemetry() {
|
|
62
100
|
this.telemetry.push((args) => {
|
|
63
101
|
Object.assign(this.telemetryProperties, {
|
|
64
102
|
id: typeof args.options.id !== 'undefined',
|
|
65
103
|
email: typeof args.options.email !== 'undefined',
|
|
66
|
-
loginName: typeof args.options.loginName !== 'undefined'
|
|
104
|
+
loginName: typeof args.options.loginName !== 'undefined',
|
|
105
|
+
userName: typeof args.options.userName !== 'undefined',
|
|
106
|
+
entraGroupId: typeof args.options.entraGroupId !== 'undefined',
|
|
107
|
+
entraGroupName: typeof args.options.entraGroupName !== 'undefined'
|
|
67
108
|
});
|
|
68
109
|
});
|
|
69
110
|
}, _SpoUserGetCommand_initOptions = function _SpoUserGetCommand_initOptions() {
|
|
@@ -75,19 +116,36 @@ _SpoUserGetCommand_instances = new WeakSet(), _SpoUserGetCommand_initTelemetry =
|
|
|
75
116
|
option: '--email [email]'
|
|
76
117
|
}, {
|
|
77
118
|
option: '--loginName [loginName]'
|
|
119
|
+
}, {
|
|
120
|
+
option: '--userName [userName]'
|
|
121
|
+
}, {
|
|
122
|
+
option: '--entraGroupId [entraGroupId]'
|
|
123
|
+
}, {
|
|
124
|
+
option: '--entraGroupName [entraGroupName]'
|
|
78
125
|
});
|
|
126
|
+
}, _SpoUserGetCommand_initTypes = function _SpoUserGetCommand_initTypes() {
|
|
127
|
+
this.types.string.push('webUrl', 'id', 'email', 'loginName', 'userName', 'entraGroupId', 'entraGroupName');
|
|
79
128
|
}, _SpoUserGetCommand_initValidators = function _SpoUserGetCommand_initValidators() {
|
|
80
129
|
this.validators.push(async (args) => {
|
|
81
130
|
if (args.options.id &&
|
|
82
131
|
typeof args.options.id !== 'number') {
|
|
83
132
|
return `Specified id ${args.options.id} is not a number`;
|
|
84
133
|
}
|
|
134
|
+
if (args.options.entraGroupId && !validation.isValidGuid(args.options.entraGroupId)) {
|
|
135
|
+
return `${args.options.entraGroupId} is not a valid GUID.`;
|
|
136
|
+
}
|
|
137
|
+
if (args.options.userName && !validation.isValidUserPrincipalName(args.options.userName)) {
|
|
138
|
+
return `${args.options.userName} is not a valid userName.`;
|
|
139
|
+
}
|
|
140
|
+
if (args.options.email && !validation.isValidUserPrincipalName(args.options.email)) {
|
|
141
|
+
return `${args.options.email} is not a valid email.`;
|
|
142
|
+
}
|
|
85
143
|
return validation.isValidSharePointUrl(args.options.webUrl);
|
|
86
144
|
});
|
|
87
145
|
}, _SpoUserGetCommand_initOptionSets = function _SpoUserGetCommand_initOptionSets() {
|
|
88
146
|
this.optionSets.push({
|
|
89
|
-
options: ['id', 'email', 'loginName'],
|
|
90
|
-
runsWhen: (args) => args.options.id || args.options.loginName || args.options.
|
|
147
|
+
options: ['id', 'email', 'loginName', 'userName', 'entraGroupId', 'entraGroupName'],
|
|
148
|
+
runsWhen: (args) => args.options.id || args.options.email || args.options.loginName || args.options.userName || args.options.entraGroupId || args.options.entraGroupName
|
|
91
149
|
});
|
|
92
150
|
};
|
|
93
151
|
export default new SpoUserGetCommand();
|
|
@@ -100,8 +100,11 @@ export default {
|
|
|
100
100
|
FOLDER_ROLEASSIGNMENT_ADD: `${prefix} folder roleassignment add`,
|
|
101
101
|
FOLDER_ROLEINHERITANCE_BREAK: `${prefix} folder roleinheritance break`,
|
|
102
102
|
FOLDER_ROLEINHERITANCE_RESET: `${prefix} folder roleinheritance reset`,
|
|
103
|
+
FOLDER_SHARINGLINK_ADD: `${prefix} folder sharinglink add`,
|
|
104
|
+
FOLDER_SHARINGLINK_CLEAR: `${prefix} folder sharinglink clear`,
|
|
103
105
|
FOLDER_SHARINGLINK_GET: `${prefix} folder sharinglink get`,
|
|
104
106
|
FOLDER_SHARINGLINK_LIST: `${prefix} folder sharinglink list`,
|
|
107
|
+
FOLDER_SHARINGLINK_REMOVE: `${prefix} folder sharinglink remove`,
|
|
105
108
|
GET: `${prefix} get`,
|
|
106
109
|
GROUP_ADD: `${prefix} group add`,
|
|
107
110
|
GROUP_GET: `${prefix} group get`,
|
|
@@ -242,6 +245,7 @@ export default {
|
|
|
242
245
|
SERVICEPRINCIPAL_SET: `${prefix} serviceprincipal set`,
|
|
243
246
|
SET: `${prefix} set`,
|
|
244
247
|
SITE_ADD: `${prefix} site add`,
|
|
248
|
+
SITE_ADMIN_ADD: `${prefix} site admin add`,
|
|
245
249
|
SITE_ADMIN_LIST: `${prefix} site admin list`,
|
|
246
250
|
SITE_APPCATALOG_ADD: `${prefix} site appcatalog add`,
|
|
247
251
|
SITE_APPCATALOG_LIST: `${prefix} site appcatalog list`,
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import config from '../../../../config.js';
|
|
2
|
+
import request from '../../../../request.js';
|
|
3
|
+
import { spo } from '../../../../utils/spo.js';
|
|
4
|
+
import SpoCommand from '../../../base/SpoCommand.js';
|
|
5
|
+
import commands from '../../commands.js';
|
|
6
|
+
class SppContentCenterListCommand extends SpoCommand {
|
|
7
|
+
get name() {
|
|
8
|
+
return commands.CONTENTCENTER_LIST;
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return 'Gets information about the SharePoint Premium content centers';
|
|
12
|
+
}
|
|
13
|
+
defaultProperties() {
|
|
14
|
+
return ['Title', 'Url'];
|
|
15
|
+
}
|
|
16
|
+
async commandAction(logger) {
|
|
17
|
+
try {
|
|
18
|
+
if (this.verbose) {
|
|
19
|
+
await logger.logToStderr(`Retrieving list of content centers...`);
|
|
20
|
+
}
|
|
21
|
+
const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
|
|
22
|
+
const allContentCenters = await this.getContentCenters(spoAdminUrl, logger);
|
|
23
|
+
await logger.log(allContentCenters);
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
this.handleRejectedODataJsonPromise(err);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async getContentCenters(spoAdminUrl, logger) {
|
|
30
|
+
const allSites = [];
|
|
31
|
+
let currentStartIndex = '0';
|
|
32
|
+
const res = await spo.ensureFormDigest(spoAdminUrl, logger, undefined, this.debug);
|
|
33
|
+
do {
|
|
34
|
+
const requestBody = `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="2" ObjectPathId="1" /><ObjectPath Id="4" ObjectPathId="3" /><Query Id="5" ObjectPathId="3"><Query SelectAllProperties="true"><Properties /></Query><ChildItemQuery SelectAllProperties="true"><Properties /></ChildItemQuery></Query></Actions><ObjectPaths><Constructor Id="1" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /><Method Id="3" ParentId="1" Name="GetSitePropertiesFromSharePointByFilters"><Parameters><Parameter TypeId="{b92aeee2-c92c-4b67-abcc-024e471bc140}"><Property Name="Filter" Type="String"></Property><Property Name="IncludeDetail" Type="Boolean">false</Property><Property Name="IncludePersonalSite" Type="Enum">0</Property><Property Name="StartIndex" Type="String">${currentStartIndex}</Property><Property Name="Template" Type="String">CONTENTCTR#0</Property></Parameter></Parameters></Method></ObjectPaths></Request>`;
|
|
35
|
+
const requestOptions = {
|
|
36
|
+
url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
37
|
+
headers: {
|
|
38
|
+
'X-RequestDigest': res.FormDigestValue
|
|
39
|
+
},
|
|
40
|
+
data: requestBody
|
|
41
|
+
};
|
|
42
|
+
const response = await request.post(requestOptions);
|
|
43
|
+
const json = JSON.parse(response);
|
|
44
|
+
const responseContent = json[0];
|
|
45
|
+
if (responseContent.ErrorInfo) {
|
|
46
|
+
throw responseContent.ErrorInfo.ErrorMessage;
|
|
47
|
+
}
|
|
48
|
+
const sites = json[json.length - 1];
|
|
49
|
+
allSites.push(...sites._Child_Items_);
|
|
50
|
+
currentStartIndex = sites.NextStartIndexFromSharePoint;
|
|
51
|
+
} while (currentStartIndex);
|
|
52
|
+
return allSites;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export default new SppContentCenterListCommand();
|
|
56
|
+
//# sourceMappingURL=contentcenter-list.js.map
|
package/dist/utils/spo.js
CHANGED
|
@@ -490,10 +490,10 @@ export const spo = {
|
|
|
490
490
|
* @param webUrl Web url
|
|
491
491
|
* @param email The email of the user
|
|
492
492
|
* @param logger the Logger object
|
|
493
|
-
* @param verbose set
|
|
493
|
+
* @param verbose set for verbose logging
|
|
494
494
|
*/
|
|
495
495
|
async getUserByEmail(webUrl, email, logger, verbose) {
|
|
496
|
-
if (verbose) {
|
|
496
|
+
if (verbose && logger) {
|
|
497
497
|
await logger.logToStderr(`Retrieving the spo user by email ${email}`);
|
|
498
498
|
}
|
|
499
499
|
const requestUrl = `${webUrl}/_api/web/siteusers/GetByEmail('${formatting.encodeQueryParameter(email)}')`;
|
|
@@ -564,10 +564,10 @@ export const spo = {
|
|
|
564
564
|
* @param webUrl Web url
|
|
565
565
|
* @param name The name of the group
|
|
566
566
|
* @param logger the Logger object
|
|
567
|
-
* @param verbose set
|
|
567
|
+
* @param verbose set for verbose logging
|
|
568
568
|
*/
|
|
569
569
|
async getGroupByName(webUrl, name, logger, verbose) {
|
|
570
|
-
if (verbose) {
|
|
570
|
+
if (verbose && logger) {
|
|
571
571
|
await logger.logToStderr(`Retrieving the group by name ${name}`);
|
|
572
572
|
}
|
|
573
573
|
const requestUrl = `${webUrl}/_api/web/sitegroups/GetByName('${formatting.encodeQueryParameter(name)}')`;
|
|
@@ -586,10 +586,10 @@ export const spo = {
|
|
|
586
586
|
* @param webUrl Web url
|
|
587
587
|
* @param name the name of the role definition
|
|
588
588
|
* @param logger the Logger object
|
|
589
|
-
* @param
|
|
589
|
+
* @param verbose set for verbose logging
|
|
590
590
|
*/
|
|
591
|
-
async getRoleDefinitionByName(webUrl, name, logger,
|
|
592
|
-
if (
|
|
591
|
+
async getRoleDefinitionByName(webUrl, name, logger, verbose) {
|
|
592
|
+
if (verbose && logger) {
|
|
593
593
|
await logger.logToStderr(`Retrieving the role definitions for ${name}`);
|
|
594
594
|
}
|
|
595
595
|
const roledefinitions = await odata.getAllItems(`${webUrl}/_api/web/roledefinitions`);
|
|
@@ -1516,6 +1516,74 @@ export const spo = {
|
|
|
1516
1516
|
};
|
|
1517
1517
|
const itemsResponse = await request.get(requestOptionsItems);
|
|
1518
1518
|
return (itemsResponse);
|
|
1519
|
+
},
|
|
1520
|
+
/**
|
|
1521
|
+
* Retrieves the file by id.
|
|
1522
|
+
* Returns a FileProperties object
|
|
1523
|
+
* @param webUrl Web url
|
|
1524
|
+
* @param id the id of the file
|
|
1525
|
+
* @param logger the Logger object
|
|
1526
|
+
* @param verbose set for verbose logging
|
|
1527
|
+
*/
|
|
1528
|
+
async getFileById(webUrl, id, logger, verbose) {
|
|
1529
|
+
if (verbose && logger) {
|
|
1530
|
+
await logger.logToStderr(`Retrieving the file with id ${id}`);
|
|
1531
|
+
}
|
|
1532
|
+
const requestUrl = `${webUrl}/_api/web/GetFileById('${formatting.encodeQueryParameter(id)}')`;
|
|
1533
|
+
const requestOptions = {
|
|
1534
|
+
url: requestUrl,
|
|
1535
|
+
headers: {
|
|
1536
|
+
'accept': 'application/json;odata=nometadata'
|
|
1537
|
+
},
|
|
1538
|
+
responseType: 'json'
|
|
1539
|
+
};
|
|
1540
|
+
const file = await request.get(requestOptions);
|
|
1541
|
+
return file;
|
|
1542
|
+
},
|
|
1543
|
+
/**
|
|
1544
|
+
* Gets the site collection URL for a given web URL using SP Admin site.
|
|
1545
|
+
* @param adminUrl The SharePoint admin URL
|
|
1546
|
+
* @param siteId The site ID
|
|
1547
|
+
* @param logger The logger object
|
|
1548
|
+
* @param verbose If in verbose mode
|
|
1549
|
+
* @returns Owner login name
|
|
1550
|
+
*/
|
|
1551
|
+
async getPrimaryAdminLoginNameAsAdmin(adminUrl, siteId, logger, verbose) {
|
|
1552
|
+
if (verbose) {
|
|
1553
|
+
await logger.logToStderr('Getting the primary admin login name...');
|
|
1554
|
+
}
|
|
1555
|
+
const requestOptions = {
|
|
1556
|
+
url: `${adminUrl}/_api/SPO.Tenant/sites('${siteId}')?$select=OwnerLoginName`,
|
|
1557
|
+
headers: {
|
|
1558
|
+
accept: 'application/json;odata=nometadata',
|
|
1559
|
+
'content-type': 'application/json;charset=utf-8'
|
|
1560
|
+
}
|
|
1561
|
+
};
|
|
1562
|
+
const response = await request.get(requestOptions);
|
|
1563
|
+
const responseContent = JSON.parse(response);
|
|
1564
|
+
return responseContent.OwnerLoginName;
|
|
1565
|
+
},
|
|
1566
|
+
/**
|
|
1567
|
+
* Gets the primary owner login from a site.
|
|
1568
|
+
* @param siteUrl The site URL
|
|
1569
|
+
* @param logger The logger object
|
|
1570
|
+
* @param verbose If in verbose mode
|
|
1571
|
+
* @returns Owner login name
|
|
1572
|
+
*/
|
|
1573
|
+
async getPrimaryOwnerLoginFromSite(siteUrl, logger, verbose) {
|
|
1574
|
+
if (verbose) {
|
|
1575
|
+
await logger.logToStderr('Getting the primary admin login name...');
|
|
1576
|
+
}
|
|
1577
|
+
const requestOptions = {
|
|
1578
|
+
url: `${siteUrl}/_api/site/owner`,
|
|
1579
|
+
method: 'GET',
|
|
1580
|
+
headers: {
|
|
1581
|
+
'accept': 'application/json;odata=nometadata'
|
|
1582
|
+
},
|
|
1583
|
+
responseType: 'json'
|
|
1584
|
+
};
|
|
1585
|
+
const responseContent = await request.get(requestOptions);
|
|
1586
|
+
return responseContent?.LoginName;
|
|
1519
1587
|
}
|
|
1520
1588
|
};
|
|
1521
1589
|
//# sourceMappingURL=spo.js.map
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import Global from '/docs/cmd/_global.mdx';
|
|
2
|
+
import Tabs from '@theme/Tabs';
|
|
3
|
+
import TabItem from '@theme/TabItem';
|
|
4
|
+
|
|
5
|
+
# flow recyclebinitem list
|
|
6
|
+
|
|
7
|
+
Lists all soft-deleted Power Automate flows within an environment
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
m365 flow recyclebinitem list [options]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Options
|
|
16
|
+
|
|
17
|
+
```md definition-list
|
|
18
|
+
`-e, --environmentName <environmentName>`
|
|
19
|
+
: The name of the environment.
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
<Global />
|
|
23
|
+
|
|
24
|
+
## Remarks
|
|
25
|
+
|
|
26
|
+
:::warning
|
|
27
|
+
|
|
28
|
+
This command is based on an API that is currently in preview and is subject to change once the API reaches general availability.
|
|
29
|
+
|
|
30
|
+
:::
|
|
31
|
+
|
|
32
|
+
:::info
|
|
33
|
+
|
|
34
|
+
To use this command, you must be a Global or Power Platform administrator.
|
|
35
|
+
|
|
36
|
+
:::
|
|
37
|
+
|
|
38
|
+
A Power Automate flow is soft-deleted when:
|
|
39
|
+
- It's a non-solution flow.
|
|
40
|
+
- It's been deleted less than 21 days ago.
|
|
41
|
+
|
|
42
|
+
If the environment with the name you specified doesn't exist, you will get the `Access to the environment 'xyz' is denied.` error.
|
|
43
|
+
|
|
44
|
+
## Examples
|
|
45
|
+
|
|
46
|
+
List all soft-deleted flows within a specific environment
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
m365 flow recyclebinitem list --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Response
|
|
53
|
+
|
|
54
|
+
<Tabs>
|
|
55
|
+
<TabItem value="JSON">
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
[
|
|
59
|
+
{
|
|
60
|
+
"name": "26a9a283-af42-4c09-aa3e-60c3cc166b90",
|
|
61
|
+
"id": "/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/26a9a283-af42-4c09-aa3e-60c3cc166b90",
|
|
62
|
+
"type": "Microsoft.ProcessSimple/environments/flows",
|
|
63
|
+
"properties": {
|
|
64
|
+
"apiId": "/providers/Microsoft.PowerApps/apis/shared_logicflows",
|
|
65
|
+
"displayName": "Invoicing flow",
|
|
66
|
+
"state": "Deleted",
|
|
67
|
+
"createdTime": "2024-08-05T23:13:54Z",
|
|
68
|
+
"lastModifiedTime": "2024-08-05T23:14:00Z",
|
|
69
|
+
"flowSuspensionReason": "None",
|
|
70
|
+
"environment": {
|
|
71
|
+
"name": "Default-d87a7535-dd31-4437-bfe1-95340acd55c5",
|
|
72
|
+
"type": "Microsoft.ProcessSimple/environments",
|
|
73
|
+
"id": "/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5"
|
|
74
|
+
},
|
|
75
|
+
"definitionSummary": {
|
|
76
|
+
"triggers": [],
|
|
77
|
+
"actions": []
|
|
78
|
+
},
|
|
79
|
+
"creator": {
|
|
80
|
+
"tenantId": "a16e76a1-837f-4bf9-82dc-78874d18e434",
|
|
81
|
+
"objectId": "bd51c64d-c262-4184-ba3f-5361ea553820",
|
|
82
|
+
"userId": "bd51c64d-c262-4184-ba3f-5361ea553820",
|
|
83
|
+
"userType": "ActiveDirectory"
|
|
84
|
+
},
|
|
85
|
+
"flowFailureAlertSubscribed": false,
|
|
86
|
+
"isManaged": false,
|
|
87
|
+
"machineDescriptionData": {},
|
|
88
|
+
"flowOpenAiData": {
|
|
89
|
+
"isConsequential": false,
|
|
90
|
+
"isConsequentialFlagOverwritten": false
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
</TabItem>
|
|
98
|
+
<TabItem value="Text">
|
|
99
|
+
|
|
100
|
+
```text
|
|
101
|
+
name displayName
|
|
102
|
+
------------------------------------ --------------
|
|
103
|
+
26a9a283-af42-4c09-aa3e-60c3cc166b90 Invoicing flow
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
</TabItem>
|
|
107
|
+
<TabItem value="CSV">
|
|
108
|
+
|
|
109
|
+
```csv
|
|
110
|
+
name,id,type
|
|
111
|
+
26a9a283-af42-4c09-aa3e-60c3cc166b90,/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/26a9a283-af42-4c09-aa3e-60c3cc166b90,Microsoft.ProcessSimple/environments/flows
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
</TabItem>
|
|
115
|
+
<TabItem value="Markdown">
|
|
116
|
+
|
|
117
|
+
```md
|
|
118
|
+
# flow recyclebinitem list --environmentName "Default-d87a7535-dd31-4437-bfe1-95340acd55c5"
|
|
119
|
+
|
|
120
|
+
Date: 06/08/2024
|
|
121
|
+
|
|
122
|
+
## 26a9a283-af42-4c09-aa3e-60c3cc166b90 (/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/26a9a283-af42-4c09-aa3e-60c3cc166b90)
|
|
123
|
+
|
|
124
|
+
Property | Value
|
|
125
|
+
---------|-------
|
|
126
|
+
name | 26a9a283-af42-4c09-aa3e-60c3cc166b90
|
|
127
|
+
id | /providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/26a9a283-af42-4c09-aa3e-60c3cc166b90
|
|
128
|
+
type | Microsoft.ProcessSimple/environments/flows
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
</TabItem>
|
|
132
|
+
</Tabs>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import Global from '/docs/cmd/_global.mdx';
|
|
2
|
+
import Tabs from '@theme/Tabs';
|
|
3
|
+
import TabItem from '@theme/TabItem';
|
|
4
|
+
|
|
5
|
+
# flow recyclebinitem restore
|
|
6
|
+
|
|
7
|
+
Restores a soft-deleted Power Automate flow
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
m365 flow recyclebinitem restore [options]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Options
|
|
16
|
+
|
|
17
|
+
```md definition-list
|
|
18
|
+
`-e, --environmentName <environmentName>`
|
|
19
|
+
: The name of the environment where the flow is located.
|
|
20
|
+
|
|
21
|
+
`-n, --flowName <flowName>`
|
|
22
|
+
: The name of the Power Automate flow.
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
<Global />
|
|
26
|
+
|
|
27
|
+
## Remarks
|
|
28
|
+
|
|
29
|
+
:::warning
|
|
30
|
+
|
|
31
|
+
This command is based on an API that is currently in preview and is subject to change once the API reaches general availability.
|
|
32
|
+
|
|
33
|
+
:::
|
|
34
|
+
|
|
35
|
+
:::info
|
|
36
|
+
|
|
37
|
+
To use this command, you must be a Global or Power Platform administrator.
|
|
38
|
+
|
|
39
|
+
:::
|
|
40
|
+
|
|
41
|
+
When a Power Automate flow is restored, it will be automatically disabled. To make it operational again, you must [enable](../flow-enable.mdx) it.
|
|
42
|
+
|
|
43
|
+
If the environment with the name you specified doesn't exist, you will get the `Access to the environment 'xyz' is denied.` error.
|
|
44
|
+
|
|
45
|
+
## Examples
|
|
46
|
+
|
|
47
|
+
Restores a soft-deleted flow within a specific environment
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
m365 flow recyclebinitem restore --environmentName Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --flowName 5923cb07-ce1a-4a5c-ab81-257ce820109a
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Response
|
|
54
|
+
|
|
55
|
+
The command won't return a response on success.
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import Global from '/docs/cmd/_global.mdx';
|
|
2
|
+
import Tabs from '@theme/Tabs';
|
|
3
|
+
import TabItem from '@theme/TabItem';
|
|
4
|
+
|
|
5
|
+
# spo folder sharinglink add
|
|
6
|
+
|
|
7
|
+
Creates a new sharing link to a folder
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
m365 spo folder sharinglink add [options]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Options
|
|
16
|
+
|
|
17
|
+
```md definition-list
|
|
18
|
+
`-u, --webUrl <webUrl>`
|
|
19
|
+
: The URL of the site where the folder is located.
|
|
20
|
+
|
|
21
|
+
`--folderUrl [folderUrl]`
|
|
22
|
+
: The server- or site-relative decoded URL of the folder. Specify either `folderUrl` or `folderId` but not both.
|
|
23
|
+
|
|
24
|
+
`--folderId [folderId]`
|
|
25
|
+
: The UniqueId (GUID) of the folder. Specify either `folderUrl` or `folderId` but not both.
|
|
26
|
+
|
|
27
|
+
`--type <type>`
|
|
28
|
+
: The type of sharing link to create. Either `view` or `edit`.
|
|
29
|
+
|
|
30
|
+
`--expirationDateTime [expirationDateTime]`
|
|
31
|
+
: The date and time to set the expiration. This should be defined as a valid ISO 8601 string.
|
|
32
|
+
|
|
33
|
+
`--scope [scope]`
|
|
34
|
+
: The scope of link to create. Either `anonymous`, `organization` or `users`. If not specified, the default of the organization will be used.
|
|
35
|
+
|
|
36
|
+
`--retainInheritedPermissions [retainInheritedPermissions]`
|
|
37
|
+
: If `true`, any existing inherited permissions are retained on the shared item when sharing this item for the first time. If `false`, all existing permissions are removed when sharing for the first time.
|
|
38
|
+
|
|
39
|
+
`--recipients [recipients]`
|
|
40
|
+
: Comma separated list of users with whom we wish to share the item with. Required when using scope `users`.
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
<Global />
|
|
44
|
+
|
|
45
|
+
## Examples
|
|
46
|
+
|
|
47
|
+
Creates a view-only anonymous sharing link of a folder by id.
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
m365 spo folder sharinglink add --webUrl https://contoso.sharepoint.com/sites/demo --folderId daebb04b-a773-4baa-b1d1-3625418e3234 --type view --scope anonymous
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Creates an edit organization sharing link of a folder by url with a specific expiration date.
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
m365 spo folder sharinglink add --webUrl https://contoso.sharepoint.com/sites/demo --folderUrl /sites/demo/shared%20documents/Folder --type edit --scope organization --expirationDateTime '2022-11-30T00:00:00Z'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Creates a user sharing link of a folder by id.
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
m365 spo folder sharinglink add --webUrl https://contoso.sharepoint.com/sites/demo --folderId daebb04b-a773-4baa-b1d1-3625418e3234 --type view --scope users --recipients john@contoso.com,doe@contoso.com
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Response
|
|
66
|
+
|
|
67
|
+
<Tabs>
|
|
68
|
+
<TabItem value="JSON">
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"id": "4fe11ccb-6c83-4927-8072-95642422b8ae",
|
|
73
|
+
"roles": [
|
|
74
|
+
"read"
|
|
75
|
+
],
|
|
76
|
+
"shareId": "u!aHR0cHM6Ly83NTY2YXZhLnNoYXJlcG9pbnQuY29tLzpmOi9nL0V2QVFpdnpLV2ZoT3ZJOHJiNm1UVEhjQjNHWkRRNlVhQ3VwNEhWeFpiR25mRkE",
|
|
77
|
+
"hasPassword": false,
|
|
78
|
+
"link": {
|
|
79
|
+
"scope": "anonymous",
|
|
80
|
+
"type": "view",
|
|
81
|
+
"webUrl": "https://contoso.sharepoint.com/:f:/g/EvAQivzKWfhOvI8rb6mTTHcB3GZDQ6UaCup4HVxZbGnfFA",
|
|
82
|
+
"preventsDownload": false
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
</TabItem>
|
|
88
|
+
<TabItem value="Text">
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
hasPassword: false
|
|
92
|
+
id : 4fe11ccb-6c83-4927-8072-95642422b8ae
|
|
93
|
+
link : {"scope":"anonymous","type":"view","webUrl":"https://contoso.sharepoint.com/:f:/g/EvAQivzKWfhOvI8rb6mTTHcB3GZDQ6UaCup4HVxZbGnfFA","preventsDownload":false}
|
|
94
|
+
roles : ["read"]
|
|
95
|
+
shareId : u!aHR0cHM6Ly83NTY2YXZhLnNoYXJlcG9pbnQuY29tLzpmOi9nL0V2QVFpdnpLV2ZoT3ZJOHJiNm1UVEhjQjNHWkRRNlVhQ3VwNEhWeFpiR25mRkE
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
</TabItem>
|
|
99
|
+
<TabItem value="CSV">
|
|
100
|
+
|
|
101
|
+
```csv
|
|
102
|
+
id,shareId,hasPassword
|
|
103
|
+
4fe11ccb-6c83-4927-8072-95642422b8ae,u!aHR0cHM6Ly83NTY2YXZhLnNoYXJlcG9pbnQuY29tLzpmOi9nL0V2QVFpdnpLV2ZoT3ZJOHJiNm1UVEhjQjNHWkRRNlVhQ3VwNEhWeFpiR25mRkE,
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
</TabItem>
|
|
107
|
+
<TabItem value="Markdown">
|
|
108
|
+
|
|
109
|
+
```md
|
|
110
|
+
# spo folder sharinglink add --webUrl "https://contoso.sharepoint.com" --folderUrl "/shared documents/folder1" --type "view" --scope "anonymous"
|
|
111
|
+
|
|
112
|
+
Date: 29/04/2024
|
|
113
|
+
|
|
114
|
+
## 4fe11ccb-6c83-4927-8072-95642422b8ae
|
|
115
|
+
|
|
116
|
+
Property | Value
|
|
117
|
+
---------|-------
|
|
118
|
+
id | 4fe11ccb-6c83-4927-8072-95642422b8ae
|
|
119
|
+
shareId | u!aHR0cHM6Ly83NTY2YXZhLnNoYXJlcG9pbnQuY29tLzpmOi9nL0V2QVFpdnpLV2ZoT3ZJOHJiNm1UVEhjQjNHWkRRNlVhQ3VwNEhWeFpiR25mRkE
|
|
120
|
+
hasPassword | false
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
</TabItem>
|
|
124
|
+
</Tabs>
|
|
125
|
+
|