Navigating between Configurable Tab and Personal App

Ryan Kuruppu 0 Reputation points
2024-07-03T05:26:44.9433333+00:00

So basically, I need to navigate from a configurable tab (one that is open during a meeting) to a page inside a personal tab.

I am aware of the microsoftTeams.pages.navigateToApp() function and right now my one looks a bit like this

await microsoftTeams.pages.navigateToApp({
  appId: this.environment.clientId,
  pageId: PageA.pageId, // directs to /room
  subPageId: PageA.subpageId, // this is :meetingId in /room/:meetingId
  webUrl: `<a-url>`,
})

As far as I understand, while you won't navigate directly to the subpageId, it will be provided in the context.page.subPageId field provided by the app.getContext() call.

However when I execute this, context.page.subPageId ends up being undefined when the personal app opens. Is there something I might be missing here ?

Basically what the code looks like is this.

const setupWebUrl = async () => {
  await microsoftTeams.app.initialize();

  const context = await microsoftTeams.app.getContext();

  const searchParams = new URLSearchParams({
    theme: context.app.theme,
  });

  if (context.user) {
    const { tenant, loginHint } = context.user

    if (tenant.id) {
      searchParams.append("tenantId", tenant.id);
    }

    if (loginHint) {
      searchParams.append("loginHint", loginHint);
    }
  }

  const subpageId = encodeURIComponent(PageA.subpageId)

  await microsoftTeams.pages.navigateToApp({
    appId: this.environment.clientId,
    pageId: PageA.pageId, // directs to /room
    subPageId, // this is :meetingId in /room/:meetingId which I will navigate to when the page defined by `pageId` gets loaded
    webUrl: `<a-url>?${searchParams.toString()}`,
  })

}
Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
9,479 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
3,006 questions
{count} votes