Calling Microsoft Graph from your Teams application – Part 4: Bots

Microsoft Teams applications almost always need to call the Graph API, yet it’s not as easy as just calling a REST service. Most of the complexity has to do with getting an Azure AD access token, which is required on every Graph call to establish what, if anything, the caller is authorized to do.

Getting the access token requires an understanding of Teams, Azure AD, Graph, and sometimes other components like the SharePoint Framework or Bot Framework, yet each of these is documented separately and each one assumes the reader knows all the others. I literally get questions every day from frustrated developers trying to figure this out! (Yesterday I got 3!) In 2 1/2 years of Teams app development, this by far the most common source of difficulties.

I wrote these articles hoping they’ll assist developers in calling the Graph from Microsoft Teams. They’re also companions for my talk, “Calling Microsoft Graph from your Teams Application”, at the PnP Virtual Conference 2020.

  1. Introduction
  2. Deep dive concepts (optional)
  3. Calling Graph from a Teams tab
  4. Calling Graph from a Teams bot (this article)

This article will explain the options for building bots for Microsoft Teams which directly call the Microsoft Graph. Two options are considered, however it will be easier to decide because there’s really only one choice per scenario.

Continue reading

Calling Microsoft Graph from your Teams Application – Part 3: Tabs

Microsoft Teams applications almost always need to call the Graph API, yet it’s not as easy as just calling a REST service. Most of the complexity has to do with getting an Azure AD access token, which is required on every Graph call to establish what, if anything, the caller is authorized to do.

Getting the access token requires an understanding of Teams, Azure AD, Graph, and sometimes other components like the SharePoint Framework or Bot Framework, yet each of these is documented separately and each one assumes the reader knows all the others. I literally get questions every day from frustrated developers trying to figure this out! (Yesterday I got 3!) In 2 1/2 years of Teams app development, this by far the most common source of difficulties.

I wrote these articles hoping they’ll assist developers in calling the Graph from Microsoft Teams. They’re also companions for my talk, “Calling Microsoft Graph from your Teams Application”, at the PnP Virtual Conference 2020.

  1. Introduction
  2. Deep dive concepts (optional)
  3. Calling Graph from a Teams tab (this article)
  4. Calling Graph from a Teams bot

This article will explain the options for building tabs for Microsoft Teams which directly call the Microsoft Graph. The same methods apply to Task Modules (modal dialog boxes).

Continue reading

Calling Microsoft Graph from your Teams application – Part 2: Deep Dive

Microsoft Teams applications almost always need to call the Graph API, yet it’s not as easy as just calling a REST service. Most of the complexity has to do with getting an Azure AD access token, which is required on every Graph call to establish what, if anything, the caller is authorized to do.

Getting the access token requires an understanding of Teams, Azure AD, Graph, and sometimes other components like the SharePoint Framework or Bot Framework, yet each of these is documented separately and each one assumes the reader knows all the others. I literally get questions every day from frustrated developers trying to figure this out! (Yesterday I got 3!) In 2 1/2 years of Teams app development, this by far the most common source of difficulties.

I wrote these articles hoping they’ll assist developers in calling the Graph from Microsoft Teams. They’re also companions for my talk, “Calling Microsoft Graph from your Teams Application”, at the PnP Virtual Conference 2020.

  1. Introduction
  2. Deep dive concepts (optional – this article)
  3. Calling Graph from a Teams tab
  4. Calling Graph from a Teams bot

The first article is intended to explain the basics which anyone should understand before embarking on a Teams project that will call Microsoft Graph. This article is an optional deep dive that will go into more detail, either for the curious or to help in troubleshooting. The articles which follow target specific scenarios, such as calling the Graph from a tab or bot in Teams.

Continue reading

Calling Microsoft Graph from your Teams application – Part 1: Introduction

Microsoft Teams applications almost always need to call the Graph API, yet it’s not as easy as just calling a REST service. Most of the complexity has to do with getting an Azure AD access token, which is required on every Graph call to establish what, if anything, the caller is authorized to do.

Getting the access token requires an understanding of Teams, Azure AD, Graph, and sometimes other components like the SharePoint Framework or Bot Framework, yet each of these is documented separately and each one assumes the reader knows all the others. I literally get questions every day from frustrated developers trying to figure this out! (Yesterday I got 3!) In 2 1/2 years of Teams app development, this by far the most common source of difficulties.

I wrote these articles hoping they’ll assist developers in calling the Graph from Microsoft Teams. They’re also companions for my talk, “Calling Microsoft Graph from your Teams Application”, at the PnP Virtual Conference 2020.

  1. Introduction (this article)
  2. Deep dive concepts (optional)
  3. Calling Graph from a Teams tab
  4. Calling Graph from a Teams bot

This article will explain the basics. If all goes well, you can follow the step-by-step instructions in one of the sample apps and be done with it! Some day, the tooling may be improved to automate some of the steps.

Continue reading

Building Microsoft Teams apps with SharePoint Pages – Part 2, Build your Own

This is Part 2 of a 2-part series which will show you how to make Teams applications using modern SharePoint pages. It’s not about the SharePoint Framework, which is a great option, but one that requires coding. This is the easy approach: if you can edit a SharePoint page, format a list, or make a Power App, you can make a Teams app.

Of course there are built-in tabs to allow adding a SharePoint page or PowerApp to Teams, but there are a number of advantages to building a proper Teams app:

  • You can distribute and manage it centrally in the Tenant App Catalog
  • Users can install it by name – no need to configure a website or Power Apps tab
  • You can use app policies to set permission and target the app to the users who need it, and optionally pin it to the Teams sidebar
  • You can be a hero for building a cool app (nobody has to know how easy it was!)

PART 1 – Introduces the Get Started app and explains Teams Tab principles

PART 2 (this article) – Shows how to use Teams App Studio and a new Tab Configuration web part to build your own static and configurable tabs

NOTE: This article has been updated to resolve issues where SharePoint pages were not displayed, especially in the desktop client. If you built apps using the original article, please update your solution using these instructions. Thanks!

App Studio

Github was a good way to share the Get Started app, so anyone can get a copy and adapt it to their needs. But if you’re starting a new app, especially a simple one based on SharePoint pages, you might like to skip the JSON and go to a tool called App Studio.

App studio is itself a Teams app (how meta!) – and it includes a great manifest editor. You can install apps right from App Studio for testing, and then export the app package for installing into the tenant App Catalog.

Here are the installation instructions.

Begin by selecting the Manifest Editor tab and create a new manifest. The editor will open, where you can enter the app details.

SPTabAppStudio001

Scroll through all the details and fill them in; details about each entry are in the manifest schema. Continue reading

Building Microsoft Teams apps with SharePoint Pages – Part 1, Get Started

This is Part 1 of a 2-part series which will show you how to make Teams applications using modern SharePoint pages. It’s not about the SharePoint Framework, which is a great option, but one that requires coding. This is the easy approach: if you can edit a SharePoint page, format a list, or make a Power App, you can make a Teams app.

Of course there are built-in tabs to allow adding a SharePoint page or PowerApp to Teams, but there are a number of advantages to building a proper Teams app:

  • You can distribute and manage it centrally in the Tenant App Catalog
  • Users can install it by name – no need to configure a website or Power Apps tab
  • You can use app policies to set permission and target the app to the users who need it, and optionally pin it to the Teams sidebar
  • You can be a hero for building a cool app (nobody has to know how easy it was!)

PART 1 (this article) – Introduces the Get Started app and explains Teams Tab principles

PART 2 – Shows how to use Teams App Studio and a new Tab Configuration web part to build your own static and configurable tabs

NOTE: This article has been updated to resolve issues where SharePoint pages were not displayed, especially in the desktop client. If you built apps using the original article, please update your solution using these instructions. Thanks!

Any SharePoint page can be a Teams Application

At events around the world lately, Karuana Gatimu has demonstrated a Get Started application that displays the Microsoft 365 Learning Pathways portal right in Microsoft Teams. Users who are new to M365 and need a little instruction can click on the app and gain access to a rich training portal.

LearningPathwaysInTeamsThe Learning Pathways training portal is right at the top of the Teams sidebar

Continue reading

Deep Linking to a SharePoint Framework Tab in Microsoft Teams

Image by Foundry Co from Pixabay

This is part 3 of a 3-part article series about building a “360 degree view” mashup for Microsoft Teams using the SharePoint Framework and React. The articles are:

  1. Part 1: 360 Degree Collaboration in Microsoft Teams
    This article introduces the 360 Degree pattern for collaborative applications, and explains a the workings of a sample solution based on SharePoint Framework and React
  2. Part 2: Working with Teams Content from an SPFx Tab
    This article explains how to access Team and channel content, such as the shared calendar and conversation, from a SharePoint Framework tab in Teams
  3. Part 3: Deep linking to a SharePoint Framework tab (this article)
    This article explains how to create a deep link that opens a Team, Channel, and tab, and passes information to your SharePoint Framework tab so you can display specific information

The series is based on a sample Teams tab written in SharePoint Framework which displays a mashup of information about customer visits.

What is a deep link?

In the world of web applications, a deep link is a link that not only selects a web page but also passes data to an application running on that page. For example, a link could open an Excel spreadsheet in a particular Team, rather than opening Teams and Excel in separate pages.

Continue reading

Working with Teams Content from an SPFx Tab

This is part 2 of a 3-part article series about building a “360 degree view” mashup for Microsoft Teams using the SharePoint Framework and React. The articles are:

  1. Part 1: 360 Degree Collaboration in Microsoft Teams
    This article introduces the 360 Degree pattern for collaborative applications, and explains a the workings of a sample solution based on SharePoint Framework and React
  2. Part 2: Working with Teams Content from an SPFx Tab (this article)
    This article explains how to access Team and channel content, such as the shared calendar and conversation, from a SharePoint Framework tab in Teams
  3. Part 3: Deep linking to a SharePoint Framework tab
    This article explains how to create a deep link that opens a Team, Channel, and tab, and passes information to your SharePoint Framework tab so you can display specific information

The series is based on a sample Teams tab written in SharePoint Framework which displays a mashup of information about customer visits.

Getting from the Tab to the Team, and beyond

As you may have heard, the great new way to write custom tabs for Microsoft Teams is to use the SharePoint Framework. One big SharePoint Framework web part makes a tab, and SharePoint takes care of hosting, single sign-on, configuration, and more.

To get started, follow this tutorial. It’s a great start, but it might leave you wondering how to interact with the Team your tab is running in, like read the meeting calendar or post a message. This article will explain how you can do that and also unlock the entire Office 365 Group from your code.

Continue reading

360 Degree Collaboration in Microsoft Teams

This is part 1 of a 3-part article series about building a “360 degree view” mashup for Microsoft Teams using the SharePoint Framework and React. The articles are:

  1. Part 1: 360 Degree Collaboration in Microsoft Teams (This article)
    This article introduces the 360 Degree pattern for collaborative applications, and explains a the workings of a sample solution based on SharePoint Framework and React
  2. Part 2: Working with Teams Content from an SPFx Tab
    This article explains how to access Team and channel content, such as the shared calendar and conversation, from a SharePoint Framework tab in Teams
  3. Part 3: Deep linking to a SharePoint Framework tab
    This article explains how to create a deep link that opens a Team, Channel, and tab, and passes information to your SharePoint Framework tab so you can display specific information

The series is based on a sample Teams tab written in SharePoint Framework which displays a mashup of information about customer visits. The Teams tab allows users to see one another’s schedules, and then brings together all the information needed for each visit. The same approach could be used for any kind of mash-up. Users can see at a glance what customer visits are approaching for each team member; when a visit is selected, the solution displays:

  • customer information (from the Northwind database OData service)
  • documents (from SharePoint)
  • recent transactions (mock)
  • a map (Bing maps)
  • current weather (Open Weather Map)
  • photos (from SharePoint)
  • a text box for sending messages to the Teams channel with deep links back to the selected visit

Continue reading

Calling Microsoft Graph from a single-page application: Part 2

This post was part of the “30 Days Microsoft Graph” blog series, now cross-posted to my personal blog. I was thrilled to have the opportunity to contribute to this excellent blog series. Many thanks to Brian Jackett, who organized this excellent blog series, and to Srinivas Varukala, who kindly edited my articles. In addition, thanks to others from the Graph and Azure AD teams who helped to test and QA the articles.

In Part 1 you learned how to register apps for both Azure AD v1 and v2 that can be used from the browser to enable Graph API calls. Today, we’ll use those registrations in some simple applications.

Continue reading