Skip to content

Change the function to get the site ID in spo site admin commands with the --asAdmin parameter. #6443

@mkm17

Description

@mkm17

Priority

(Medium) I'm annoyed but I'll live

Description

Hi, when I tested the spo site admin list command with --asAdmin parameter for a script sample, I saw that there is an issue to get site id using the current method used. Currently it returns error when current user have SP admin permissions but it does not have access to a site.

Commands affected:

spo site admin add
spo site admin remove
spo site admin list

Steps to reproduce

Remove all existing permissions of the current user from the SharePoint site. Run spo site admin list --asAdmin.

Expected results

It should get a list of admins, even if the user does not have any permission to the site.

Actual results

It gives an error when the user does not have access to a site.

Diagnostics

No response

CLI for Microsoft 365 version

10.0.0

nodejs version

18.20.2

Operating system (environment)

Windows

Shell

PowerShell

cli doctor

No response

Additional Info

The fix can be done by replacing spo.getSiteId with spo.getSiteAdminPropertiesByUrl as proposed by @milanholemans in one of the commands.

Please assign this task to me.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions