web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Code App in Teams Tab ...
Power Apps
Suggested Answer

Code App in Teams Tab not receiving query parameters from Teams deep link (Activity Notification)

(1) ShareShare
ReportReport
Posted on by 2

Hi all,

 

I'm working on a Power Apps Code App embedded in a Microsoft Teams tab, and I’m trying to pass parameters from a Power Automate flow using Microsoft Graph sendActivityNotification. 

āœ… Scenario

 

•Teams custom tab app hosting a Power Apps code app

 

•Sending notification using Power Automate → HTTP → Graph API

 

•Using topic.webUrl to open the app via Teams deep link

āœ… What I’m trying to achieve

 

Pass a parameter (e.g. record ID or navigation key) from the notification so that when the user clicks it:

 

•Teams opens the tab

 

•Power Apps code app receives the parameter

 

•App navigates to the correct screen/item

āœ… What I implemented

 

Deep link used inside topic.webUrl:

 

https://teams.microsoft.com/l/entity/<APP_ID>/<PAGE_ID>?tenantId=<TENANT_ID>&context=%7B%22subEntityId%22%3A%22linereports%22%7D

 

Inside the Power Apps code app: 

import { getContext } from "@microsoft/power-apps/app"; 

const ctx = await getContext(); 

console.log(ctx.app.queryParams);

āŒ Issue 

ctx.app.queryParams only contains:

{

 

  "hidenavbar": "true",

 

  "tenantId": "..."

 

}

👉 Custom parameter (linereports) is not available 

āœ… Additional attempts

 

•Tried using TeamsJS:

import { app } from "@microsoft/teams-js";

await app.initialize(); // fails with timeout

Error:

SDK initialization timed out (Ocdi)

āœ… Questions

 

1.Is it possible to access subEntityId (or subPageId) inside a Power Apps code app?

 

2.Is there a supported way to pass parameters from Teams deep link into a Power Apps code app?

 

3.Do we need to configure the Teams tab content URL placeholders (e.g. {page.subPageId}) for this to work?

 

4.Is TeamsJS unsupported inside Power Apps code apps because of the nested iframe?

āœ… Expected outcome

Ideally I want: 

ctx.app.queryParams.itemId === "linereports"

āœ… Any guidance appreciated! 

If anyone has implemented this with:

 

•Power Apps Code Apps

 

•Teams tab deep linking

 

•Activity feed notifications

I have the same question (0)
  • Suggested answer
    Valantis Profile Picture
    6,647 on at
     
    Found the root cause. In Teams JS SDK v2, the subEntityId from a deep link context is stored in page.subPageId, not in query parameters. The Power Apps Code Apps getContext() exposes queryParams but not the full Teams page context object, which is why your custom parameter doesn't appear.
     
    To answer your specific questions:
     
    1. subEntityId is not directly accessible via ctx.app.queryParams in Code Apps. It's in the Teams JS SDK context at page.subPageId, which getContext() doesn't currently expose in the queryParams map.
     
    2. The supported workaround for passing parameters from a Teams deep link into a Code App: embed your parameter in the webUrl as an actual query
     
    parameter rather than in the context JSON. Change your deep link to:
     
    Then in your Code App read it via ctx.app.queryParams.itemId. Parameters in the webUrl are passed through to the app as queryParams.
     
    3. Yes, configure the Teams tab content URL placeholder {page.subPageId} in your manifest if you go the subEntityId route, but since Code Apps use Power Apps hosting not a custom URL, you can't inject placeholders there directly. The webUrl query parameter approach is more practical.
     
    4. TeamsJS SDK initialization timing out in Code Apps is a confirmed known issue. Code Apps run in an iframe within the Power Apps player which is already in a Teams iframe double-nested iframes break TeamsJS SDK initialization. Don't use TeamsJS directly in Code Apps.
     
     

     

    Best regards,

    Valantis

     

    āœ… If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ā¤ļø If it didn’t fully solve it but was still useful, please click ā€œYesā€ on ā€œWas this reply helpful?ā€ or leave a Like :).

    🏷ļø For follow-ups  @Valantis.

    📝 https://valantisond365.com/

    💼 LinkedIn

    ā–¶ļø YouTube

  • Suggested answer
    Vish WR Profile Picture
    3,711 on at
     
     

    For passing parameters into a Power Apps Code App inside a Teams tab, the most reliable approach is to embed the parameter directly in the webUrl as a query string rather than relying on subEntityId/context. For example:

    https://teams.microsoft.com/l/entity/APP_ID/PAGE_ID?tenantId=TENANT_ID&webUrl=https://your-tab-url?itemId=linereports

    You can then read it via ctx.app.queryParams.itemId in the Code App. Also worth noting: TeamsJS SDK initialization will time out inside Code Apps because the app runs in a double-nested iframe (Code App inside the Power Apps player inside Teams), so it's best avoided for this scenario.


     
  • Sushant Salunkhe Profile Picture
    2 on at
    Thank you guys nothing worked I tried all.
    cheers,
    sushant
  • Valantis Profile Picture
    6,647 on at

    Hi @Sushant Salunkhe,

    Just wanted to check in and see if everything is working now. If you still need any help, feel free to let me know.

    Also, if the issue is resolved, it would be great if you could mark the answer as solved so others with the same question can find it easily.

     

    Thanks and have a great day!

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 494

#2
WarrenBelz Profile Picture

WarrenBelz 352 Most Valuable Professional

#3
11manish Profile Picture

11manish 323

Last 30 days Overall leaderboard