Can I create channels in Microsoft Teams using the API? - microsoft-graph-api

I am not a programmer - just trying to find the answer to a question about Microsoft Teams. I'd like my dev team to automate some processes in Teams including the creation and archive of channels. Can anyone let me know if this is possible via the API?
TIA

Channels are available in Microsoft Graph API (on beta endpoint). To create a channel, you can POST to a /channel endpoint:
POST https://graph.microsoft.com/beta/teams/{id}/channels
Content-type: application/json
{
"displayName": "Channel Name",
"description": "Channel Description"
}
{id} in the request URL is the ID of the Team (not to be confused with the ID of Group that owns the team). The request needs to contain Auth token (bearer token) in Authorization header.
More info about this method is available on Microsoft Graph documentation page:
https://learn.microsoft.com/en-us/graph/api/channel-post?view=graph-rest-1.0

I've created a command line tool that lets you bulk create new Microsoft Teams channels using the Graph APIs outlined above. It's written in C# and .NET Core, and includes instructions that describe how you register your application for use with your Teams environment.
https://github.com/tamhinsf/ChannelSurf
Feel free to use it as an example or starter kit for your own needs!

Sorry, this capability is not exposed through a developer API right now but is on the roadmap.

Related

How to register an attendee for a webinar via Microsoft Graph API

I want to register attendee in Microsoft Team Webinar by using my system, for this I need an API.
Does Graph API support to add an attendee for a webinar?
Using following graph API you can set the allowedRegistrant as everyone or organization.
1.Create meetingRegistration - POST /me/onlineMeetings/{id}/registration
2.Update meetingRegistration - PATCH /me/onlineMeetings/{id}/registration
These APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported.
Ref Doc:
https://learn.microsoft.com/en-us/graph/api/meetingregistration-post?view=graph-rest-beta&tabs=http
https://learn.microsoft.com/en-us/graph/api/meetingregistration-update?view=graph-rest-beta&tabs=http

MS Graph API Authentication | MS Teams | Bot framework

I am new to bot development. I am working on creating a MS Teams bot using bot framework. The bot will be installed in ‘Personal’ scope in Teams, and it doesn’t have any tab / messaging extension etc. Once installed, I want to get the list of all the members/ channels/ Notification updates (i.e. members added/deleted etc.). As per the different documentation, I can get the list using Graph API.
List members of team - Microsoft Graph v1.0 | Microsoft Docs
List members of a channel - Microsoft Graph v1.0 | Microsoft Docs
To achieve this, I need the token that will be passed in API. I am not sure how to implement that. I have followed the instructions mentioned in Add authentication to a bot in Bot Framework SDK - Bot Service | Microsoft Docs. There was a step to add ‘Add OAuth Connection Settings’ and there were multiple options in ‘Service Provider’. I selected ‘Azure Active Directory v2’. After doing that, it works and I can get the token, but it only works if during login, I user my azure directory credentials. I have a Microsoft account linked with my MS Teams which id different than the Azure account. A user in team can have a Microsoft account / work / office account so this needs to work for everyone so what would be the correct ‘Service Provider’ option that will work for all accounts?
I was thinking that the flow should be like:
When clicks on ‘Add’ button to install the app in Teams
Once added, bot will prompt for Graph API permission using OAuth.
Once user gives the permission, I can use the token to call graph APIs.
I have also looked at the following tutorials:
How to use Bot Framework Composer to build low-code Microsoft Teams bots (Part 1)
Get user profile information in your Microsoft Teams bot with Microsoft Graph (Part 2) - YouTube
But after performing all the steps, when I try to login, it says – ‘This action can't be performed since the app does not exist or has been uninstalled.’.
I am not getting a clear approach on how to proceed with it.
As #Maxim has also suggested, if you want to have a bot that should run multitenant you need to put tenant Id as common in OAuth Setting in Azure bot. As the value suggest it isn't going to specific to single tenant and Redirect Uri should be set to https://token.botframework.com/.auth/web/redirect in app registration.
This is it, you don't need to add anything.
This is also mention in the doc --
We have some sample around it as well that shows how to use Graph API with the bot -
https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/csharp_dotnetcore/24.bot-authentication-msgraph
You can setup this one and update the Graph calls to get member of team or channels.

Microsoft Office 365 Apps Usage

I am trying to collate information corresponding to Microsoft 365 Apps Usage of our employees as shown in some reports on Admin Portal(admin.microsoft.com). We are facing some challenges in getting report data corresponding to these in our code.
I need following information for integration in our web application:
Do we have any Graph API or PowerShell cmdlet(not deprecated) exposed which can be integrated in our code to get Microsoft Apps Usage Data(like ProPlusUsageUserDetail excel data downloaded from admin portal)?
Can we get Version Details of Microsoft 365 Apps and Services being used by users?
We have already used graph api GetOffice365ActiveUserDetail (adding link below for reference) which give usage for only Microsoft Services and not Apps:
https://learn.microsoft.com/en-us/graph/api/reportroot-getoffice365activeuserdetail?view=graph-rest-1.0
We need same kind of information for Microsoft 365 Apps (Word, Excel, PowerPoint etc.)as well .
You can try portal.office.com and check the reports to see if you have related report is available apart from that, at this point i am not aware such information you can request from Microsoft Graph APIs. Consider raising a feature request in User voice, so that Microsoft can consider it. Here's the link for it https://microsoftgraph.uservoice.com/forums/920506-microsoft-graph-feature-requests?query=report

Accessing and creating Teams Chats via Graph API

I'm going over the Microsoft Teams section of the Graph API and trying to find out how to do two things:
Create a new chat, giving it a topic that correlates to an entity in our app (essentially creating a chat around an entity), invite specific users into it, and send messages to the chat.
Access the currently logged-in user's private chats, filtered by their topic, and show their contents inside our app.
For #2, it looks like it should be possible using beta endpoint of the Graph API, but I get 403 Forbidden errors both in the Graph Explorer when trying to access https://graph.microsoft.com/beta/me/chats, and in my own app, after enabling the Chat.Read permissons for it.
For #1, it looks like the API doesn't officially support creating new chats at all.
Is there any approach we can use to create and manage chats? Is there an alternative, perhaps not MicrosoftGraph-based API?
as you mention, the ms graph doesn't yet support initiating group chat. You would use the MS Bot Framework for this: https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/bots/bot-conversations/bots-conv-proactive
I see the docs on these Chat api do exist, but they are not present in the Graph Explorer. I tired testing them in the OfficeApiEditor tool with a v2.0 App Registration and Delegated permissions (Chat.Read) and i get this:
Failure - Status Code 500
"code": "InternalServerError",
"message": "Error while processing response.",
so maybe it will take some time before they are really available in beta.
In MS teams, there is a api called ChatMessage to post a message to a chat(only if the chat already exist or started). But, there is no api to create/start a new chat. I have raised a feature request. Do vote for this to suggest this idea to Microsoft.
https://microsoftteams.uservoice.com/forums/913786-microsoft-teams-free/suggestions/38776681-it-would-be-awesome-l-if-there-is-an-api-functiona

Create Microsoft Team from Office365 group

I am facing a problem with creating a Microsoft Team from an Office365 group, I found a thread Skype beta API but when I send the request I get an 'unauthorized' error. In the thread above Bernd told that he can provide a working sample.
We don't currently have support for creating a Microsoft Teams team through any of the existing APIs (Microsoft Graph or other). We are working on a Graph API solution for this, so stay tuned.

Resources