Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - GCC, GCCH, DoD - Federal App Maker...
Answered

How do I collect the URL of the page a powerapp form is used on?

(1) ShareShare
ReportReport
Posted on by 6
Goal:
I want to add a subscribe button to multiple SharePoint pages to offer users the ability to be alerted when an update is made to that page. I understand I will need to build a flow as well, but first I am building the app.  I would like the app to collect the users email and the page they subscribed to a SharePoint list. At some point the subscribe button would also then become an unsubscribe button.  
 
Situation:
So far I have an app with:
1. Text Input >named>>txtPageName >> default text is >>ThisItem.PageURL 
2. Text Input >named>> txtUserEmail >> default text is >>User().Email  
3. Button >named>> btnSubscribe >> Action OnSelect is >>Patch('Subscription list',Defaults('Subscription list'),{Title: txtPageName.Text,'User Email': User().Email,'Subscription Date': Now()} ); Notify("You  have successfully subscribed!",NotificationType.Success)
 
SharePoint List Columns:
Title
User Email
 
When I use the app from a SharePoint page the user email is populating to the list but the but the Title column returns ThisItem.PageURL.  
 
 
Question:
What changes do I need to make to successfully capture the URL of the page the app is being used on?
Categories:
  • Verified answer
    Gabriel G. Profile Picture
    673 on at
    How do I collect the URL of the page a powerapp form is used on?
    I did exactly that application for a Sharepoint page :). All you need is to add a parameter to the url with '&paramName=value'. Then, on your app, you can collect the parameter with Param("paramName") in your 'onStart' event of the app.
     
    It should look like this: 

    app url: 
     
    In app:
     Then, you can process as you wish depending on the parameter you got from the url.
    ___________________________________________
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
  • vipuljain03 Profile Picture
    477 on at
    How do I collect the URL of the page a powerapp form is used on?
    Have you checked what values you are getting with SPHostUrl and SPPageUrl
  • AP-06081712-0 Profile Picture
    6 on at
    How do I collect the URL of the page a powerapp form is used on?
    Thank you @vipuljain03 for the detailed explanation. 
    I was eager to jump in and try your suggestions.  I tried both options, and updated the patch to reflect the change but it continues to come up blank.  What could I be missing?
    Param("SPHostUrl") & Param("SPPageUrl") 
    OR
    Param("WebPartFullPageUrl") 
  • vipuljain03 Profile Picture
    477 on at
    How do I collect the URL of the page a powerapp form is used on?
    Issue:
    The issue will be how ThisItem.PageURL is being understood within the Power Apps context when embedded in a SharePoint page.
     
    You are setting the default text of the txtPageName to ThisItem.PageURL. This is only going to work within the context of a SharePoint list or library form. Since you are embedding this app on a SharePoint page, this context does not exist.
     
    Solution:
    Use the Param() function in Power Apps to capture the URL parameters that SharePoint passes to the embedded app. SharePoint passes the page URL as a parameter when you embed a Power App. Instead of using ThisItem.PageURL as the default text, use Param("SPHostUrl") & Param("SPPageUrl") OR Param("WebPartFullPageUrl")
     
    Param("SPHostUrl") - This retrieves the base URL of the SharePoint site where the app is embedded.
    Param("SPPageUrl") - This retrieves the relative URL of the specific page where the app is embedded.
    Note: By concatenating these two parameters (SPHostUrl & SPPageUrl), you reconstruct the full URL of the SharePoint page.
     
    Param("WebPartFullPageUrl") - fetches the full URL of the SharePoint page where the Power Apps app is embedded.
     
    ---------------------------------------------------------------------
    If this reply helped you, please mark this reply as suggested answer ✔️ and give it a like to help others in the community find the answer too!
    Thanks,
     
     

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Featured topics