Navigate to new Teams page

80 Views Asked by At

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

We have two Razer 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 please.

Thanks.

2

There are 2 best solutions below

0
On BEST ANSWER

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.

0
On

I've not worked with Blazer, but I can't imagine it's much different than the Javascript world for this - Teams Toolkit basically scaffolds you up with the teams js library anyway, so don't worry about that. Separately though, if you're navigating within your own app, I think you won't need to worry about deep linking, it should just work the same as if the user visited the page in the browser. They won't have browser back and forward though, as there's no browser frame, so make sure to provide relevant nav to the user.

With regards getting Teams context, you need to make sure you're calling the teams js getContext method - Teams Toolkit should be doing that for you in the sample page it would provide, I'd think, but if not you need to call it yourself, with a relevant callback.