The commands spo customaction get and spo customaction list each call the SharePoint API to get and list custom actions. We'd like to reuse this functionality for the new applicationcustomizer commands #4244 and #4251 and for the new commandsetcustomizer commands.
To be able to reuse the code we'll have to be able to influence the API request URL, for example to add a filter to query only customactions with a specific location value.
This issue is about creating that shared code and enhance the spo customaction get and spo customaction list commands to use it.
We need to add the following functions to the spo util class:
getCustomActions(args)
The getCustomActions(args) function can be used by the list commands to get a list of customactions.
It can also be used by get commands when getting a custom action by title, as is possible with spo customaction get
The function should have the following parameters:
| Parameter |
Type |
Description |
webUrl |
string |
The site to execute the request on. |
scope |
web, site or all |
The scope to get the custom actions for. When using all, the request will be executed for both site and web scope. |
filter |
string |
An OData filter query to limit the results. |
getCustomActionById(args)
The getCustomActionById(args) function can be used by the get commands to get a single customaction by id.
The function should have the following parameters:
| Parameter |
Type |
Description |
webUrl |
string |
The site to execute the request on. |
scope |
web, site or all |
The scope to get the custom actions for. When using all, the request will be executed for both site and web scope. |
id |
string |
the Id of the custom action. |
The commands
spo customaction getandspo customaction listeach call the SharePoint API to get and list custom actions. We'd like to reuse this functionality for the new applicationcustomizer commands #4244 and #4251 and for the new commandsetcustomizer commands.To be able to reuse the code we'll have to be able to influence the API request URL, for example to add a filter to query only customactions with a specific
locationvalue.This issue is about creating that shared code and enhance the
spo customaction getandspo customaction listcommands to use it.We need to add the following functions to the spo util class:
getCustomActions(args)
The
getCustomActions(args)function can be used by thelistcommands to get a list of customactions.It can also be used by
getcommands when getting a custom action bytitle, as is possible withspo customaction getThe function should have the following parameters:
webUrlscopeweb,siteorallall, the request will be executed for bothsiteandwebscope.filtergetCustomActionById(args)
The
getCustomActionById(args)function can be used by thegetcommands to get a single customaction by id.The function should have the following parameters:
webUrlscopeweb,siteorallall, the request will be executed for bothsiteandwebscope.id