Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

TeamsApplication

Mika Berglund edited this page Mar 15, 2021 · 4 revisions

TeamsApplication Component

The TeamsApplication component is the most important component in Blazorade Teams. You don't write a single tab application without it. This component makes your life so much easier.

Parameters

Name Type Description
RequireDefaultScopes bool Defines whether the application requires an access token that grants the scopes that you define in the Startup class of your application.
RequireScopes string A comma-separated list of scopes to include when acquiring an access token for the application. Can be combined together with RequireDefaultScopes.
ApplicationTemplate RenderFragment<ApplicationContext> This is the template that you use to write the majority of your application in. The template is rendered when TeamsApplication has gotten all the data that your application needs. This is provided to your application in the context variable for the template. This includes the Teams context and authentication result, if you set RequireAuthentication to true.
HostNotAvailableTemplate RenderFragment The template that is rendered if TeamsApplication detects that the application is not loaded inside of Teams, but rather as a standalone web application.
LoadingTemplate RenderFragment<ApplicationContext> The template that is rendered while TeamsApplication resolves all data for you.

Examples

Below are a few examples of how you use the TeamsApplication component.

Displaying Authenticated User

The code below will render a level 2 heading with the name of the user that has been authenticated with Azure AD.

Please note that you need to go through the Getting Started section before the below code will work.

<TeamsApplication RequireDefaultScopes="true">
    <ApplicationTemplate Context="ctx">
        <h2>Tab App for @ctx.AuthResult.IdTokenClaims["name"]</h2>
    </ApplicationTemplate>
</TeamsApplication>