pnp / cli-microsoft365

Manage Microsoft 365 and SharePoint Framework projects on any platform
https://aka.ms/cli-m365
MIT License
896 stars 318 forks source link

Bug report: `m365 teams meeting list` doesn't work when specifying `--userName` in an application only context #5968

Closed MathijsVerbeeck closed 3 weeks ago

MathijsVerbeeck commented 4 months ago

Priority

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

Description

When executing the command m365 teams meeting list using an application only context and specifying userName it will not work and return a very string error message 'UnknownError'. When specifying --debug it looks like it fails on the /users/userName/onlineMeetings. This also happens in the Graph Explorer, so it seems like it's a MS issue.

I did not test, but the same way of working is used in m365 teams meeting transcript list.

Steps to reproduce

Login using application context Execute the command specifying --userName

Expected results

A list of Teams meetings

Actual results

Error message:
image

Diagnostics

No response

CLI for Microsoft 365 version

v7.6.0

nodejs version

20.11.0

Operating system (environment)

Windows

Shell

PowerShell

cli doctor

No response

Additional Info

The error message when specifying --debug is the following: image

Adam-it commented 4 months ago

Thanks @MathijsVerbeeck for bringing it up 👍

waldekmastykarz commented 4 months ago

Seems like application permissions are not supported for the endpoints, so the limitation is by design. We should however show a user-friendly error that the command only works for delegated permissions and update our docs to call it out as well.

MathijsVerbeeck commented 4 months ago

Seems like application permissions are not supported for the endpoints, so the limitation is by design. We should however show a user-friendly error that the command only works for delegated permissions and update our docs to call it out as well.

@waldekmastykarz the strange thing is that it works when specifying userId

waldekmastykarz commented 4 months ago

Seems like application permissions are not supported for the endpoints, so the limitation is by design. We should however show a user-friendly error that the command only works for delegated permissions and update our docs to call it out as well.

@waldekmastykarz the strange thing is that it works when specifying userId

Which is odd, because when you look at the docs, app permissions are not supported: https://learn.microsoft.com/en-us/graph/api/onlinemeeting-get?view=graph-rest-1.0&tabs=http#permissions. It's possible that docs are incorrect though. That said, if it works with a userId and not with userName, then I suggest that we change the implementation for now to use the userId and work around this issue.

Saurabh7019 commented 2 months ago

change the implementation for now to use the userId and work around this issue.

Can I make this change?

milanholemans commented 2 months ago

Thank you @Saurabh7019!

Saurabh7019 commented 1 month ago

Just tested and got errors with both the --email and --userId parameters. These results appear to be consistent with the current documentation.

image

Saurabh7019 commented 1 month ago

Just tested and got errors with both the --email and --userId parameters. These results appear to be consistent with the current documentation.

Ignore that... The app permission works for the both email and userId if the application access policy is configured correctly. I will include this info in CLI docs.