Microsoft Teams Graph API List members - microsoft-teams

When using the microsoft teams graph api to get list of members in a team, I'm also getting the owner names as part of the list. Is there any easy way to get just the members? Currently I'm using a complicated method of making two graph calls, one for owners and another for members and then manually comparing and eliminating owners from the member list.

If you have a Bot as part of your project, then instead of using the Graph you can use the latest release of the Bot Framework to get the relevant people. See the V4.9 release note of the bot framework, which state:
The TeamsChannelAccount object has been updated to include userRole (one of owner, member, or guest) and tenantId (for the user's tenantId).

Related

Outlook - MS Graph API - how to check Room Sharing options?

I am building a REST integration using MS Graph 1.0.
I am basically creating Room bookings using the createEvent API and this works just fine.
Now as I understand, some Rooms can be private, meaning only shared with specific Users or Groups. How can I check that using MS Graph? Is there a dedicated API for this? O rmaybe at least you can point me to the relevant object/property I should be looking into?
I want to check if the user triggering the integration is one of the users/groups allowed to book that Room and only then create the invite for that room.
Thanks!
Have you tried looking in to places API room resource type, it has bookingType property which says whether the room is standard/reserved. https://learn.microsoft.com/en-us/graph/api/resources/room?view=graph-rest-beta#bookingtype-values.

Bot Framework - add member to Teams group chat

I have a group chat on Microsoft Teams with 4 members: 3 people and a bot. Is it possible for the bot to add a new member to the existing group chat?
I found the method deleteConversationMember of the class BotFrameworkAdapter, which should remove an existing member. Well, I would need the opposite, adding a new member.
I have also checked Microsoft Teams Graph API, but it seems to be possible only to get members and not add a new one.
As I see from your comment, you're trying to have the bot escalate, or "hand off" to a service desk agent. If that's correct, you can have a look at another model for this altogether, where the user continues to chat with the bot, but the messages are being sent, by the bot, to an agent behind the scenes. This is referred to as a "handoff", and you can see a blog post here and source code (from the blog author) here on github
The BotFrameworkAdapter methods use the Bot Framework REST API, which itself calls channel-specific API's. As you've seen in the Teams Graph API, adding a member to a group chat is not currently supported and even if it was that Graph API is in preview and not suited for production applications. This document explains how to give feedback if you want to request this feature.
As a workaround, I recommend having the bot give the existing group members some instruction on adding the new member to the group themselves.
If you'd like to go with a bot-to-human handoff solution like Hilton suggested, you might be interested in this new sample: https://github.com/arturl/lpproxybot

MS teams: Easy way to get team/chat members?

Is there any way to get the team members in a tab scope using the SDK? I know you can get them by using Graph API, it's just that I wonder if there's a faster way to get them. It would be very useful to apply some context to the info displayed on the tab.
And I've got the same question for groupchat scope. In fact, I can see a method called getChatMembers, but it's not working nor visible at the docs, so I suppose it's not deployed yet.
Nevertheless, in docs I can read:
Because a malicious party run your content in a browser, this value
should be used only as a hint as to who the members are and never as
proof of membership
This kind of advise appears on several fields, so I suppose that using Graph API is safer.
In Tab Context you can get teamId, teamName, channelId etc. In order to get members in Tab you can use /members Graph API. For Bot you can get the team roaster in bot context.
getChatMembers is not yet available for 3P apps. We are working on it.

Google Classroom - How to list only created/updated/deleted courses

I am trying to create a google sync API(background API using scheduler) which basically updates my database courses with the google classroom courses.
The Google Classroom API does not seem to have a mechanism for fetching only create/update/delete courses. right now I am able to fetch all courses from google classrooms using google classrooms API but i want only created/updated/deleted courses list.
Also, can I call my API endpoint, if a course is created/updated/deleted into google classrooms course?
Upon checking the documentation, it is not yet supported. You can restrict returned courses to those in one of the specified states "only" using courseStates parameter.
Possible states a course can be in.
COURSE_STATE_UNSPECIFIED
ACTIVE
ARCHIVED
PROVISIONED
DECLINED
SUSPENDED
If the feature hasn't been requested yet, you can file a feature request on the Issue Tracker.
I got a reply on Google Issue Tracker after creating a feature request:-
Google Issue Tracker Url:
https://issuetracker.google.com/issues/74175718
Reply:
So, you're correct that we don't yet support returning the list of courses which have been updated since your last sync. I've changed this to a feature request to reflect that.
However, in case it's helpful to you, we do offer two things that might address some of your needs:
(1) Our courses.list endpoint (https://developers.google.com/classroom/reference/rest/v1/courses/list) guarantees that results are ordered by most recently created. So it should be easy to detect all the courses that have been created since the last sync by doing timestamp comparisons.
(2) If your sync job is running with the credentials of a domain administrator, you can use push notifications (https://developers.google.com/classroom/guides/push-notifications) to get updated when the rosters change for all courses in the domain (course creation will appear as a notification that the primary teacher has been added to the course, so you should be able to detect that as well).

How can I programatically add a user to a team?

We have a public channel which we would like to link to from an external site. Unfortunately the link which teams gives will not add you to the team. How do I add the user to the team so that the link will kick them into that team's channel?
Right now there is no way to add a user except through the team owner's add user interface. We are working on Office Graph APIs that would support this, but no ETA on that yet.
You can use the MS Graph APIs for adding users to the underlying group. It may take up to an hour for it to be reflected in Teams. We are working on enhancing the Graph APIs to eliminate this latency completely.

Resources