Search code examples
c#blazormicrosoft-teamsteams-toolkit

Navigate to new Teams page


New to Teams (and Blazor) dev and are stumped by a seemingly simple question using the Teams Toolkit.

We have two Razor pages (ie. under the "Pages" folder in the project - as any asp.net core app has) and want to click from one page to the next from within our Teams Tab App (ideally using an tag) but happy for the navigation code to be executed from the @code block.

I've read pretty much everything I can find on this, but like all fairly new tech, the documentation (to me) is confusing at this early stage eg. do we need the teams-js library in addition to the Teams Toolkit to use deep links, or can we just redirect by getting the URL info from the context (which we can't get also).

We have tried (by way of an example):

@inject NavigationManager nav

and then in the @code block:

nav.NavigateTo({nav.BaseUri}/TermsOfUse);

but that just returns:

"Sorry, there's nothing at this address."

Lots of confusion at the moment so just some pointers would help.


Solution

  • Teams Tab App is not a very confusing concept, it is very simple. Give Teams a link, Teams show it as a tab. So, regard the project as a simple web app with frontend. If the nav works well in browser, it can also work in Teams. Do not need to concern about the js library and the context.