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 addspo site admin removespo 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.
Great suggestion, @mkm17. Since the commands are currently working but just require an extra permission scope, I suggest that we categorize this as an enhancement instead of a bug.
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
withspo.getSiteAdminPropertiesByUrl
as proposed by @milanholemans in one of the commands.Please assign this task to me.