On a few locations we have validation logic that checks if a option is in use from a set of options. For example within spo folder roleassignment remove.
|
const principalOptions: any[] = [args.options.principalId, args.options.upn, args.options.groupName]; |
|
if (principalOptions.some(item => item !== undefined) && principalOptions.filter(item => item !== undefined).length > 1) { |
|
return `Specify either principalId id, upn or groupName`; |
|
} |
|
|
|
if (principalOptions.filter(item => item !== undefined).length === 0) { |
|
return `Specify at least principalId id, upn or groupName`; |
|
} |
This can be achieved by adding the values wihtin principalOptions to this.optionSets.
#initOptionSets(): void {
this.optionSets.push(
['principalId', 'upn', 'groupName']
);
}
Following command could use this convertion
| Command |
Options |
| aad app add |
[manifest, name] |
| adaptivecard send |
[card, title] |
| planner bucket get |
[id, name] |
| planner plan get |
[id, title] |
| spo file roleassignment add |
[principalId, upn, groupName], [roleDefinitionId, roleDefinitionName] |
| spo file roleassignment remove |
[principalId, upn, groupName] |
| spo list roleassignment add |
[listId, listTitle, listUrl], [principalId, upn, groupName], [roleDefinitionId, roleDefinitionName] |
| spo list roleassignment remove |
[listId, listTitle, listUrl], [principalId, upn, groupName] |
| spo listitem list |
[id, title, listId, listTitle] |
| spo listitem roleassignment remove |
[listId, listTitle, listUrl], [principalId, upn, groupName] |
| spo page clientsidewebpart |
[standardWebPart, webPartId] |
| spo sitedesign get |
[id, title] |
| spo sitedesign get |
[id, title] |
| spo web roleassignment add |
[principalId, upn, groupName], [roleDefinitionId, roleDefinitionName] |
| spo web roleassignment remove |
[principalId, upn, groupName] |
| teams team archive |
[id, name, teamId] |
| teams team remove |
[id, name, teamId] |
| teams team unarchive |
[id, name, teamId] |
On a few locations we have validation logic that checks if a option is in use from a set of options. For example within
spo folder roleassignment remove.cli-microsoft365/src/m365/spo/commands/folder/folder-roleassignment-remove.ts
Lines 91 to 98 in 0d30334
This can be achieved by adding the values wihtin
principalOptionstothis.optionSets.Following command could use this convertion