pnp / cli-microsoft365

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

New command: `m365 teams meeting list` #3899

Closed appieschot closed 1 year ago

appieschot commented 1 year ago

Usage

m365 teams meeting list

Description

Retrieve all online meetings for a given user

Options

Option Description
-u, --userId [userId] The id of the user, omit to retrieve meetings for current signed in user. Use either id, userName or email, not all.
-n, --userName [userName] The name of the user, omit to retrieve meetings for current signed in user. Use either id, userName or email, not all.
--email [email] The email of the user, omit to retrieve meetings for current signed in user. Use either id, userName or email, not all.
--startDateTime [startDateTime] The startdate used to query for meetings
--endDateTime [endDateTime] The enddate used to query for meetings
--isOrganizer Set to retrieve only meetings the user is organizer for

Examples

Lists all meetings for garthn@contoso.com

m365 teams meeting list --userName garthn@contoso.com

Lists all meetings for current signed in user

m365 teams meeting list

Additional Info

The only endpoint to retrieve meetings from is the https://graph.microsoft.com/v1.0/me/events or https://graph.microsoft.com/v1.0/[username]/events but that does not support filtering on the onlineMeeting or onlineMeetingUrl, isOnlineMeeting, onlineMeetingProvider properties. We should filter the results on ?$filter=isOrganizer eq true to get all meetings you have organized and loop through the URLs in code to validate if there is aonlineMeetingUrl(or filter in code on theisOnlineMeetingI guess, as we need theJoinUrl` to retrieve details or transcripts.

Since it is a list command show subject, start, end

⚠️ requires additional permissions so please put those in the PR to make sure we do not forget: Calendars.Read

We will need a check to make sure userName is required when they are signed in with app permissions.

Jwaegebaert commented 1 year ago

Specs look good to me @appieschot. πŸš€

I don't know if we need to include it in our specs but we will need a check to make sure userName is required when they are signed in with app permisions.

appieschot commented 1 year ago

Thanks, opened up and added remark about the permissions πŸš€

MathijsVerbeeck commented 1 year ago

I would like to work on this.

appieschot commented 1 year ago

Awesome! All yours, keep in mind that currently the App Registration is missing permissions so in order to build you might want to use a custom app reg with the calendar.read permission 🦾

MathijsVerbeeck commented 1 year ago

Hi @appieschot

Just a quick question. Would it be useful to also include the userId? Also, I recall that, when creating outlook message get, we named the field userName userPrincipalName, Should we change the name to keep it more consistent or should we leave it like this?

Finally, just a small remark, but in the specs you forgot to add /users between v1.0/[userName]/events

milanholemans commented 1 year ago

Wouldn't it be possible to list all meetings there are and introduce a flag --organizer or something so you only list the meetings you are organizing?

Also, wouldn't it make sense to specify some kind of date? If we retrieve all meetings of a particular user without starting/end date, it could be hundreds or thousands of meetings and the command would take a long time to complete.

appieschot commented 1 year ago

Just a quick question. Would it be useful to also include the userId? Also, I recall that, when creating outlook message get, we named the field userName userPrincipalName, Should we change the name to keep it more consistent or should we leave it like this?

I can't find the spec for the outlook message get sorry .. If we look at teams channel member add we use a userId and userDisplayName. If we look at aad user get we provide id, userName, email and for yammer group list we only support userId. My preference would be the aad user get scenario where we provide the three different properties. If we all agree on that approach for consistency I can update all commands linked to this one with the specs

Finally, just a small remark, but in the specs you forgot to add /users between v1.0/[userName]/events

Whoops, totally right! Updated specs

Wouldn't it be possible to list all meetings there are and introduce a flag --organizer or something so you only list the meetings you are organizing?

Hmm, my take was that we could have a outlook calendar event list to get all outlook calendar items and use this command to only work with teams meetings. As we cannot retrieve transcripts or details for meetings you are not an organizer for it felt natural to me to provide only results you can actually use and if you are looking at working with calendar items to refer to another command.

Also, wouldn't it make sense to specify some kind of date? If we retrieve all meetings of a particular user without starting/end date, it could be hundreds or thousands of meetings and the command would take a long time to complete.

Yeah totally makes sense, we could introduce a --startDate and --endDate for that, or would you expect a --startTime for fine grain selection? If we agree on date or time ill update specs

MathijsVerbeeck commented 1 year ago

I can't find the spec for the outlook message get sorry .. If we look at teams channel member add we use a userId and userDisplayName. If we look at aad user get we provide id, userName, email and for yammer group list we only support userId. My preference would be the aad user get scenario where we provide the three different properties. If we all agree on that approach for consistency I can update all commands linked to this one with the specs

Makes sense, as this is a new command (which still has to be merged). I'm fine with using the three options as options for the command, however, this would mean that we have to make a call to the command aad user get to retrieve the correct userId / userPrincipalName, but that would be no issue I think

In regards of the other remarks from @milanholemans , I'll let him answer. πŸ˜„

milanholemans commented 1 year ago

Hmm, my take was that we could have a outlook calendar event list to get all outlook calendar items and use this command to only work with teams meetings. As we cannot retrieve transcripts or details for meetings you are not an organizer for it felt natural to me to provide only results you can actually use and if you are looking at working with calendar items to refer to another command.

Yeah maybe but that will return all your calendar events right? Also events that are no Teams meeting. Personally I'd expect m365 teams meeting list to return all my teams meetings, but maybe that's just me.

Yeah totally makes sense, we could introduce a --startDate and --endDate for that, or would you expect a --startTime for fine grain selection? If we agree on date or time ill update specs

I'd say let's use dateTime, that way the user can decide if he wants to pass a time value or not.

Jwaegebaert commented 1 year ago

I can't find the spec for the outlook message get sorry .. If we look at teams channel member add we use a userId and userDisplayName. If we look at aad user get we provide id, userName, email and for yammer group list we only support userId. My preference would be the aad user get scenario where we provide the three different properties. If we all agree on that approach for consistency I can update all commands linked to this one with the specs

@appieschot It's a good idea to create an issue to tackle this. πŸ‘

appieschot commented 1 year ago

@MathijsVerbeeck I updated the specs based on our discussion, let me know if anything is still unclear and thanks for sticking with us πŸ’ͺ

@Jwaegebaert will create an issue to research what other commands we have that might have this issue :)

MathijsVerbeeck commented 1 year ago

@appieschot Just one final question. While implementing the command outlook message get (PR #3868, Issue: #2993 ), we also made it possible to retrieve a specific mail from a shared mailbox.

Would it be handy if we implement this also for retrieving the events? If so, we will have to add the permission Calendars.Read.Shared for that to work.

appieschot commented 1 year ago

The goal for this command was to get a list of events to retrieve transcripts for, since you can only retrieve transcripts for stuff you are a meeting organizer for. So, implementation of the shared mailbox version is not something I was looking for, but happy to add it as an enhancement. Can you add the remark for permissions in the PR? Or does it also need code changes to work properly?

MathijsVerbeeck commented 1 year ago

It would not need code changes I think (will have to quicky test this), bit I will have to change the description of the specs a bit obviously to make it clear that we also support this.

DP3103 commented 4 months ago

I am trying to retrieve all the meetings from all Teams Room accounts in my organization ~1200 rooms using application permissions. Calendar.Read and OnlineMeetings.Read.All, but the command is working only on few rooms, for the rest it gives Error: 3003: User does not have access to lookup meeting . Any advise? Thanks!

milanholemans commented 4 months ago

Hi @DP3103, we're using this Graph API endpoint to fetch meetings: https://learn.microsoft.com/en-us/graph/api/onlinemeeting-get?view=graph-rest-1.0&tabs=http#permissions

As you can see under the permissions table, you have to take some steps additional to make it work with application permissions.

DP3103 commented 4 months ago

Hi @DP3103, we're using this Graph API endpoint to fetch meetings: https://learn.microsoft.com/en-us/graph/api/onlinemeeting-get?view=graph-rest-1.0&tabs=http#permissions

As you can see under the permissions table, you have to take some steps additional to make it work with application permissions.

Thanks for the reply Milan - I do have the CsApplicationAccessPolicy granted for the accounts which i am trying to retrieve meeting data using M365 CLI. image

Running the command in --debug mode is actually retrieving the content , but at the end it errors out. image

milanholemans commented 4 months ago

Is there a possibility that you can copy-paste data from the --debug output so we have more context? You can always anonymize sensitive data if needed in the response.