Skip to content

Enhancement: Refactor customaction get/list commands to query SharePoint through a util class #4327

@martinlingstuyl

Description

@martinlingstuyl

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.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions