Skip to content

Refactor 'spo list roleassignment add' to use util instead of calling other command #5157

@martinlingstuyl

Description

@martinlingstuyl

The following command:
https://pnp.github.io/cli-microsoft365/cmd/spo/listitem/listitem-roleassignment-add

is quite annoying to work with in a sense.

  • The called commands do not write their logs to the console. So you don't really know what's going on when using --verbose or --debug.
  • If I write --roleAssignmentName "Full Control" (but my site language is dutch) the command will throw a nondescript error message, saying: Error: Cannot read properties of undefined (reading 'Id'). The point is that it cannot find the role definition, because those are returned in a list with dutch titles. We should at least show a proper error message.

Point 1 should be fixed when refactoring to a util.
Point 2 can be fixed at the same time.

Related to #4531.

Requirements

  • Refactor to a listitem util function.
  • Take explicit care to add intelligible errors when dependant objects aren't found. (such as the user when --upn is used)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions