Chapter 7: Extend Microsoft Teams Using Custom Apps and Microsoft 365 – Hands-On Microsoft Teams

Chapter 7: Extend Microsoft Teams Using Custom Apps and Microsoft 365

Microsoft Teams can be extended using apps from app store as we have seen in the previous chapter but it can be also extended with custom apps built for your business specifically. In this section of the book, you will learn how custom apps can be enabled on your tenant and how you can use other tools from the Microsoft 365 ecosystem to extend the default functionalities.

If you are using SharePoint, Power Apps, or Power Automate, in this chapter you will learn how to integrate these three platforms with Microsoft Teams.

In the following pages, you will find information about these main topics:

  • Working with custom apps
  • Installing custom apps
  • Blocking Microsoft Teams apps
  • Extending Microsoft Teams using SharePoint
  • Extending Microsoft Teams using PowerAutomate
  • Extending Microsoft Teams using PowerApps

Working with custom apps

Organizations are all different and have their own rules and internal processes. However, even though the Microsoft Teams store provides an awesome way of extending the platform, it will not be able to cover all the requirements of the different organizations.

To overcome this problem, Microsoft Teams allows you to upload custom apps built by developers for your organization. This way, you will be able to extend the platform according to your specifications.

Enabling custom apps

Custom apps must be enabled by the administrator and in this section, we will see how it can be done:

  1. Start by opening the Microsoft Teams admin center at https://admin.teams.microsoft.com.
  2. On the vertical menu, expand Teams apps and then click on Manage apps.
  3. Click on the Org-wide app settings button:

    Figure 7.1: Org-wide settings

  4. Toggle the option Allow interaction with custom apps to On. This way, you can allow your users to upload custom apps that are not available in the store:

    Figure 7.2: Enabling interaction with custom apps

  5. Click Save.

As an administrator, you should be careful with the rollout of custom apps into Microsoft Teams. You should only install apps from trusted sources and you should plan who will be able to install this type of app. Even though custom apps get enabled globally in the org-wide settings, you can restrict who will be able to upload them through the use of setup policies, which is what we will see in the next section.

Disabling custom apps

Custom apps will be able to access information on your tenants, so it's recommended to plan which users will have the necessary permissions to install them. To restrict the installation of custom apps, you can disable this functionality on the Global (Org-wide default) policy – this way, each new user will not have the ability to upload custom apps. To do it, follow these steps:

  1. Open the Microsoft Teams admin center.
  2. On the vertical menu, expand Teams apps and then click on Setup policies.
  3. Select Global (Org-wide default).
  4. Click on the Edit button on the toolbar:

    Figure 7.3: Edit App setup policies

  5. Toggle the Upload custom apps option to Off.
  6. Click Save, and note that modifications of these policies can take up to 24 hours to be applied:

Figure 7.4: Disabling custom app upload

Uploading custom apps

Now that you have disabled the upload of custom apps globally, you need to create a new policy that allows users to upload this type of app. To create a new policy for custom apps, do the following:

  1. Open the Microsoft Teams admin center.
  2. On the vertical menu, expand Teams apps and then click on Setup policies.
  3. On the toolbar, click on Add.
  4. Provide a name and a description for your policy.
  5. Toggle the Upload custom apps option to On:

Figure 7.5: Enabling custom app upload

You now need to apply the new policy to the users who will have the power to upload custom apps. The profiles that should have access to this option are different in every organization but here are some examples you should consider:

  • Administrators
  • Developers
  • Some team owners

To apply the custom app policy to your chosen users, do the following:

  1. Open Microsoft Teams admin center.
  2. On the vertical menu, click on Users.
  3. Select the users that will have the power to upload these apps.

    Note

    You should not apply it to more than 20 users at a time. If you have more than 20 users, you can do this in batches or using PowerShell. PowerShell for Microsoft Teams is explained in Chapter 10, Microsoft Teams PowerShell – a Tool for Automation

  4. Click on Edit settings.
  5. On App setup policy, select your policy for Custom Apps.
  6. Click Apply, remembering that custom policies can take up to 24 hours to be applied:

Figure 7.6: Applying a custom policy

Pro Tip:

When managing Microsoft Teams, you will stumble across multiple terms with reference to apps. As an admin, it's important to know all the concepts and the differences between them as they can be a bit confusing:

(a) Third-arty apps – Third-party apps are all the apps installed by users from the app store.

(b) Custom apps or side-loading apps – Both names are associated with apps uploaded to the tenant without using the app store.

Installing custom apps

Now that you know how to enable custom apps and how to give permissions to the right users to install them, it is time to learn how the installation process works.

Note:

The process described in this section uses a prebuilt custom app from Microsoft to install Microsoft Learning Pathways on Microsoft Teams. To learn more about this solution, visit https://docs.microsoft.com/en-us/office365/customlearning/. If you want to know more about how to build custom apps for Microsoft Teams, have a look at Chapter 8, Build Your Own App for Microsoft Teams Using App Studio.

If you are a user with permissions to upload custom apps, do the following:

  1. Open Microsoft Teams and click on Apps.
  2. At the bottom of the window, click on Upload a custom app.
  3. On the menu, choose whether you want to install it globally for all the users in the tenant or just for you and your teams:

    Figure 7.7: Uploading a custom app

  4. Upload the ZIP file containing the app and click Open.
  5. When you choose to install the app for you and your teams, a pop-up window will open and you will have to click on Add as shown in the following screenshot:

    Figure 7.8: Adding a new app

  6. When you choose to install the app globally in the tenant, after uploading the ZIP file, a new category is created in the app store's vertical menu, as shown in the following screenshot:

    
Figure 7.9: Installed custom app

  7. To install the app, you need to click on it and then, on the popup, click on Add:

Depending on the custom app type, the Add button might assume different layouts with different options. The following screenshot represents the possible variants:

Figure 7.10: Add button – variations

Let's see what each of these options are:

(a) Add: This means that the app will become available globally.

(b) Add to a team: This means that the app will be installed in a team. When the button displays just this option, it means the app cannot be used in any other context and you will not be able to use it as a personal app.

(c) Add to a chat: This means that the app can be installed and added to a group chat or to a one-to-one chat.

(d) Open: This is not represented in the screenshot, but this option means that the app is already installed in your tenant and ready to be used.

Installing custom apps as an administrator

As an administrator, you will be able to install apps from the app store, as explained in the preceding section, or from the Manage Apps screen available in the admin center by doing the following:

  1. Open the Microsoft Teams admin center at https://admin.teams.microsoft.com.
  2. On the vertical menu, expand Teams apps and click on Manage apps.
  3. On the toolbar, click on Upload new app:

    Figure 7.11: Uploading a new app as administrator

  4. From the Upload a new custom app pop-up window, click on Select a file.
  5. Select the ZIP file of your app and click OK.
  6. Wait a few seconds for the confirmation message.

Apps installed from the admin center will become available to all the users in your organization.

Blocking Microsoft Teams apps

So far, we have seen how you can enable and disable the usage of Microsoft custom apps, but restricting the usage of these apps might be prejudiced against the adoption of the platform. A Microsoft Teams administrator always has the possibility to block custom apps or even apps installed from the store.

If you want to restrict the usage of apps on your tenant after being installed, do the following:

  1. Start by opening the Microsoft Teams admin center at https://admin.teams.microsoft.com.
  2. On the vertical menu, expand Teams apps and then click on Manage apps.
  3. Click on the Org-wide app settings button:

    Figure 7.12: Org-wide settings

  4. Scroll down on the side menu to the Blocked apps section.
  5. Search the app you want to block by name as highlighted in the following screenshot. This search will retrieve not just the custom apps installed by you and other users, but also apps in the store that are available for you to install. Once an app is blocked by the administrator in Org-wide app settings, it will not be available to be used by any user in the tenant:

Figure 7.13: Blocked apps

Click on the name of the app you want to block and then click Save.

Now that you know how custom apps can be managed and installed on Microsoft Teams, as an administrator, you will be able to decide how this feature will be available to your users.

Microsoft Teams can be extended with custom apps, but also with platforms that you probably already have in-house and have been using for a long time. The next section explains how SharePoint can be used to build your own custom apps for Microsoft Teams.

Extending Microsoft Teams using SharePoint

SharePoint is one of the key components of the Microsoft Teams structure and has been around since 2001, meaning that a lot of organizations have their information systems on this platform.

The SharePoint apps described in this section come pre-installed on Microsoft Teams and are available to be used in all types of teams and channels.

Using out-of-the-box integrations

As explained in the first section of the book, each team on Microsoft Teams is built on top of a SharePoint site that is used to store information shared by the team. While SharePoint can be used just to store documents, you can also take advantage of the powerful features of the platform, such as the custom pages, news, or lists, to create complex information systems.

To bring content stored on SharePoint to Microsoft Teams, you can use the out-of-the-box apps highlighted in the following screenshot:

Figure 7.14: SharePoint apps

Document Library

Document Library is a tab similar to the default files tab library you get on each team. While the files tab only gets you documents from the shared documents library in the site collection, this one allows you to pick any library from any site collection. To use this app in one of your teams, do the following:

  1. Add the Document Library tab to the channel where you want to get the documents.
  2. Select the site where the document library is located either by choosing from the Relevant sites list or by using a SharePoint link to the site or to the library.
  3. Click on Next:

    Figure 7.15: Document Library selection

  4. Choose the library you want to add and click Next.
  5. Provide a Name for the new tab. By default, the application suggests the name of the library.
  6. Click Save.

The document library is a great resource when you need to bring documents from SharePoint to the Microsoft Teams context. The users will be able to perform the same actions they do on SharePoint, such as editing, uploading, renaming, and deleting files, however, the app does not give you access to custom views like the default files tab does:

Figure 7.16: SharePoint document library

Notice that this app respects the permissions on SharePoint, which means that if the users in the team don't have access to the library selected in the app configuration, they will not see any documents.

SharePoint News

Microsoft Teams doesn't have a feature that you can use to post news and announcements for the entire team, however, you can take advantage of SharePoint to do so. SharePoint team sites include by default an option to create pages and publish them as news, however, there is no mechanism to notify the users that something new was posted.

The SharePoint News connector allows you to automatically post news in a channel when it is published on SharePoint. This app is not pre-installed on Microsoft Teams and needs to be added from the store. To do so, follow these steps:

  1. Open Microsoft Teams and click on Apps.
  2. Search for SharePoint News and click on the app with this name when it appears.
  3. Click on Add to team.
  4. Select the team where you want to add the connector.
  5. Click on Set up connector and then Save.

The connector will do the configuration automatically and will connect to the SharePoint site collection associated to the team. This connector will only work on standard channels – private channels and site collections do not include the News feature:

Figure 7.17: SharePoint News connector

The news is posted in the channel using a card format and when the user clicks on it, they are redirected to the news in the browser, as illustrated in the following screenshots:

Figure 7.18: SharePoint News posts in Microsoft Teams

SharePoint

The SharePoint app allows you to add pages and lists to a channel from the site collection of the team. It has a simple configuration interface where you are able to select the list or the page you want to display, as shown in the following screenshot:

Figure 7.19: SharePoint list selection

A modern SharePoint page is designed to be displayed inside of Microsoft Teams. This means that the page will be displayed without the logo and navigation; it will only display the web parts (web parts on SharePoint are the equivalent to apps on Microsoft Teams) you have in the page.

Unlike the document library, this app does not allow you to select pages or lists from other site collections, but as a workaround, you can use the Website app, which allows you to embed any web page into a tab.

The main difference between both applications is that on the configuration window, Website requires you to add the link manually. Visually, they are very similar, and the only thing you will notice when using Website is an info message at the top the page, as highlighted in the following screenshot:

Figure 7.20: SharePoint list using the Website app

As a SharePoint user, you will be able to integrate both platforms using the out-of-the-box apps. As we will see in Chapter 8, Build Your Own App for Microsoft Teams Using App Studio, there is much more you can do with SharePoint and Microsoft Teams to build a reliable and centralized modern workplace.

In our next section, we will see how to build our own custom apps using Power Automate.

Extending Microsoft Teams using Power Automate

Microsoft Power Automate (formerly known as Microsoft Flow) is a tool that allows us to create automated workflows without writing code. It has more than 300 connectors divided between a free and a premium plan.

Note:

Most of the connectors from Microsoft 365 are included in the free plan and you can use it as part of your existing subscription without extra costs.

One of the free integrations available is Microsoft Teams, with which you can automate processes for you or your teams.

In this section of the book, you will learn, with the aid of examples, how easy it is to set up a workflow using Power Automate and also how they can be managed from the Microsoft Teams context.

Case study: Paul, the blog manager

Paul is the company WordPress blog manager and does all the posts and scheduling. To reach a broader internal audience, Paul wants each post to be promoted on the general channel that all the users have access to on Microsoft Teams.

Since some of the posts are scheduled and Paul wants this task to be fully automated, he will use Power Automate to publish a message on the general channel with the title, date, and link for the new post.

The idea described in this scenario can be implemented by doing the following:

  1. Open Microsoft Power Automate at https://flow.microsoft.com/.
  2. On the vertical menu, click on Create.
  3. On the Create menu, click on Automated Flow.
  4. On the popup, provide a name for your flow.
  5. Select the trigger. A trigger is an event that will start the flow execution. In this scenario, the blogging platform used is WordPress, so you need to select the trigger named When a post is created.
  6. Click on Create:

    Figure 7.21: Building an automated flow

  7. Authenticate on WordPress. This step is common to all the triggers from third-party connectors, as you need to grant permissions to Power Automate to let it access your data from a third-party platform.
  8. At the flow stage, click on New step.
  9. Search for Microsoft Teams.
  10. Select the action named Post your own adaptive card as the Flow bot to a channel. Adaptive cards are built with JSON and are an easy way to post structured information on several Microsoft 365 platforms. Adaptive cards can be built visually using the designer tool (https://adaptivecards.io/designer/). Once you get the desired layout, you can copy the generated JSON and reuse it:

    Figure 7.22: Posting an adaptive card

  11. Select the team and the channel where you want to post the card.
  12. In the Message text box, paste the JSON code.
  13. Look for the placeholders where you want to add the text from the post and click on the corresponding post field. Fields are added to the JSON in the cursor location once you click on them.
  14. Click on Save.

Every time this flow is executed, it will automatically post a message on Microsoft Teams using the card format you have built, as the following screenshot demonstrates. Posts are made by Power Automate and the card includes information about the author of the message:

Figure 7.23: Adaptive cards in Microsoft Teams

Microsoft Teams can be used for actions, as we have seen in this example, but it can also be used as a trigger. The following lists detail all the available integrations and even though some of them are still in preview, you should be able to use them without any issues.

Triggers:

  • When a new channel message is added
  • When I am mentioned in a channel message
  • When a new member is added

Actions:

  • Get messages: This action gets messages from a channel into a team.
  • Post a choice of options as the Flow bot to a user: This action creates a card with a set of options that a user must choose before responding.
  • Post a message: This message is posted into a team channel.
  • Post a reply to a message.
  • Create a channel.
  • List Channels.
  • List Teams: Lists the teams you are a member of.
  • Post a message as the Flow bot to a channel.
  • Post a message as the Flow bot to a user.
  • Post an Adaptive Card to a Teams channel and wait for a response.
  • Post an Adaptive Card as the Flow bot to a user.
  • Post an Adaptive Card as to a Teams user and wait for a response.
  • Post your own adaptive card as the Flow bot to a channel.
  • Post your own adaptive card as the Flow bot to a user.

Power Automate can also be integrated with Microsoft Teams using an app available in the Microsoft Teams store.

Note

At the time of writing, the app is still available with the old name – Flow.

Flow is available as a personal app and as a tab, and allows you to build your automations directly from Microsoft Teams.

The personal app also gives you access to the approval list and to the bot that allows you to trigger your flows using natural language. The following screenshot displays the personal flow app, showing the user view of their own Flows:

Figure 7.24: Managing Flows from Microsoft Teams

The tab displays your team flows and also allows you and your team members to create new ones. When creating a new Teams flow using the tab app, it fills in the form automatically with the team and channel details. The following illustrates how the tab app looks in configuration mode:

Figure 7.25: Creating a Flow from Microsoft Teams

Extending Microsoft Teams using PowerApps

Power Apps is a platform that empowers everyone to build business applications without writing code. With a simple and intuitive layout, it empowers every user to build more to achieve more. Microsoft Teams wants to embrace the power of apps created by users and allows you to use them on the platform. This way, we can say that every Power App is also a Teams app.

Note:

This section of the book does not cover the creation of an app; it only shows how you can integrate an existent app into Microsoft Teams.

Let's now take a look at a scenario to understand this better.

Case study: Adele, the event manager

Adele is responsible for all the events at the company and has a budget to manage during the year. To help her with all the events and with the visualization of how much is being spent on each one, Adele has created a PowerApp based on the data she already had.

Now that the app is working, Adele wants to share it with her team members so everyone can be aware of how much was spent.

Power Apps is available on Microsoft Teams as a tab only. This means that you can only use it in a channel or in a chat context. Every time you add a Power App to Microsoft Teams, you should guarantee that all the users will have access to the original Power App.

To start adding a Power App to one of your teams, do the following:

  1. Go to the app store, search for PowerApps, and click on it.
  2. Select the Channel or the Chat that you want to add it to.
  3. Establish the connection between Power Apps and Microsoft Teams – this is necessary to get access to your apps.
  4. Select the app you want to add:

    Figure 7.26: Adding an app to Microsoft Teams

  5. Click on Save.

The app is added to a tab showing the original name you gave to it on Power Apps, and the layout will reflect exactly what you did on the original app. The following screenshot displays the Power Apps app behaving as a native Teams app:

Figure 7.27: A Power Apps app in Microsoft Teams

If you don't want to add the app to a team but instead want to use it as a personal app, you will need to download the application package from the PowerApps application itself. To do this, do the following:

  1. Open the PowerApps website at https://make.powerapps.com/.
  2. From the vertical menu, click on Apps.
  3. Select the app you want to install and click on the button to open the More options menu.
  4. Click on Add to Teams:

    Figure 7.28: Adding an app to Microsoft Teams from Power Apps

  5. From the vertical menu, click on Download app:

    Figure 7.29: Downloading a Power Apps app

  6. Save the ZIP file.
  7. Upload the application package to Microsoft Teams, as described in the Installing custom apps section.

Once uploaded and installed, you will be able to access to your Power Apps app from the vertical app menu, as shown in the following screenshot:

Figure 7.30: A Power Apps app in Microsoft Teams as a personal app

Summary

In this chapter, you have learned how to extend Microsoft Teams in a more advanced way using the tools and platforms that are included on the Microsoft 365 platform. We also demonstrated, through the use of scenarios, how you can integrate the collaboration and communication areas of a modern workplace by building custom apps without writing code.

In the next chapter, we will continue to explore the options available to extend Microsoft Teams, and you will learn how to create a personal app from scratch without writing code.