Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Microsoft Teams for Java Developers Part 1: Getting Started

0.00/5 (No votes)
13 Oct 2021 1  
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.

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:

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:

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.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here