Click here to Skip to main content
15,112,866 members
Articles / Hosted Services / Azure
Posted 13 Oct 2021

Tagged as


3 bookmarked

Microsoft Teams for Java Developers Part 1: Getting Started

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
13 Oct 2021CPOL5 min read
This article is an introduction to Microsoft Teams development.
Here we help enterprise software developers realize just how much they can accomplish by developing applications for Teams.

This article is a sponsored article. Articles such as these are intended to provide you with information on products and services that we consider useful and of value to developers

One of the biggest challenges in creating new enterprise software is getting people to use it. Many enterprise employees already use Microsoft 365, including Microsoft Teams. So, it’s easier to adopt new applications within Teams, since they’re using familiar tools.

Corporate Java developers can take advantage of Teams to ensure quick user adoption. All we need to do is incorporate our apps and existing APIs into the productivity and collaboration tool everyone’s already using every day.

Business workflows are becoming increasingly complex, both in terms of software components and human interactions. We need to integrate various systems and provide new functions — or extend existing ones. At the same time, our users want to work with a minimal number of tools. Who wants to learn yet another piece of software when they’re trying to get their work done? When we integrate our applications into Teams, we help our corporate users find everything they need in one place.

We can use our existing Java developer skills to integrate apps into Teams quickly. We can even add complex AI-powered features, like intelligent conversational bots, without dealing with AI model training and evaluation. Developing Microsoft Teams apps helps extend our portfolio while working with fun features.

This three-part series explains how to start developing Java extensions for Teams using standard Java tools, including IntelliJ IDEA, Spring MVC, and Spring Cloud all running on the Azure Spring Cloud service. We start by exploring core Microsoft Teams capabilities and entry points then demonstrate how to prepare our development environment.

By the end of this series, you’ll know how to develop your custom tabs and bots for Teams. Let’s start with the basics.

Extending Teams

From the developer perspective, Teams extensions are just web applications that we deploy to the Internet. We can use our existing Java skills, and even our existing apps, to create a Teams extension.

After we create our app, all we need to do is to create a Teams manifest. This manifest contains information about our Teams app’s capabilities, links to our web app, and some additional metadata, such as author information and version.

To install the app into Teams, we may need some support from our company’s Microsoft 365 administrator. The administrator can enable users to install the extension or install the Teams app for the entire organization, given the manifest we prepared.

We can use four capabilities to extend Microsoft Teams:

  • Bots: These apps automate repetitive and straightforward tasks. Many companies use bots to accelerate handling support and customer service, among other uses.
  • Tabs: We can use tabs to embed custom web content in Teams. With tabs, we can bring our existing web-based resources to Teams or provide access to frequently used items.
  • Messaging extensions: These extensions enable us to send requests to a web service through user interface (UI) elements, like buttons and forms, from the Microsoft Teams client. We can easily incorporate our existing APIs into Teams using messaging extensions.
  • Webhooks and connectors: With webhooks, we can use our custom HTTP callbacks to notify Teams users about custom actions. Users subscribe to these hooks through connectors.

When building an app for Teams, we typically map the use case to one of the above capabilities. For more information, review the general rules for mapping your use cases to capabilities.

Teams apps can combine capabilities. A Teams app is a web app — Microsoft doesn’t host your app. To make your app available to a Teams client (the app running on the user’s machine), you first need to publish your app. You can do this using your on-premises infrastructure or cloud services, like Microsoft Azure.

Eventually, for local testing, you can use a tool like ngrok. You can find more information about testing and debugging Teams apps in the Microsoft Teams developer documentation.

Setting up the Development Environment

It takes just a few steps to start building your custom app for Microsoft Teams. First, sign up for the Microsoft 365 Developer Program, free for 90 days.

You can also get a Microsoft 365 E5 subscription, as we’ll use it throughout this article series. Setting up the subscription is straightforward. Just provide the administrator user name and your domain. Then, you will see a screen like the one below. You also have the option to use the screen to install the sample Users data pack by clicking the + Users button at the bottom:

Image 1

The Users data pack contains 16 fictitious users. The users have associated licenses, mailboxes, names, and photos.

Your next step is to enable Teams for your organization and ensure you can install custom Teams apps.

Lastly, ensure you have your favorite IDE.

For deployment, we use Microsoft Azure but feel free to use any other hosting platform. We use the Spring Cloud service in Microsoft Azure, which we create using the Basic pricing tier in the Azure Portal.

We configure our Azure Spring Cloud instance with the name db-spring-cloud-82. We also disable Logs (in the Diagnostics Settings tab) and disable Application Insights to reduce our costs. The final configuration we use is as follows:

Image 2

Setting up Other Developer Tools

After deploying our web app, we’ll need to create our Teams manifest. You can do this using App Studio or Developer Portal for Teams. Here, we use App Studio, the Teams app.

Another tool you might find helpful is Microsoft Graph SDK for Java. It lets us access data from Microsoft 365 services, including OneDrive, SharePoint, OneNote, and Calendar in our Java apps.

Next Steps

Microsoft Teams apps help ensure your users actually use your Java apps since they’re easily accessible where everyone is working. You now know what tools you will need, so it’s time to get started creating a Teams app of your own.

In the next article of this series, we’ll create a Teams tab based on a sample Spring MVC web application deployed to Azure Spring Cloud. Our tab’s application will be a simple to-do list to help our organization’s workers keep their projects on track.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Dawid Borycki
United States United States
Dawid Borycki is a software engineer and biomedical researcher with extensive experience in Microsoft technologies. He has completed a broad range of challenging projects involving the development of software for device prototypes (mostly medical equipment), embedded device interfacing, and desktop and mobile programming. Borycki is an author of two Microsoft Press books: “Programming for Mixed Reality (2018)” and “Programming for the Internet of Things (2017).”

Comments and Discussions

GeneralMy vote of 5 Pin
Ștefan-Mihai MOGA15-Oct-21 5:51
professionalȘtefan-Mihai MOGA15-Oct-21 5:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.