How to get current SharePoint page url to pass to PowerApps via parameter

Dave Mack 0 Reputation points
2023-06-27T10:29:04.7866667+00:00

I have a PowerApp to gather feedback on a SharePoint site. My intention was to somehow get the current SP page url (or title) and somehow pass that via a param to the PowerApp so we can determine which page the feedback refers to without the user having to specify.

Is there a way I can get the URL (or page title) of the current page and then pass that to the App?

I have seen examples using C# and Javascript to get the page url but I'm not sure if my business permission and access will allow running code.

I thought I could do something like this in the link "Link_to_PowerApp?url=then some code to get the page url"

Any help or suggestions welcome.

Thanks

Office
Office
A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.
1,920 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,233 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Yanli Jiang - MSFT 29,126 Reputation points Microsoft Vendor
    2023-06-28T02:28:13.3866667+00:00

    Hi @Dave Mack ,

    According to your description, the issue may be more related to Power Apps.

    Power Apps is currently not supported in the Q&A forum. Please start a new discussion via the Power Apps Community so that you can get dedicated support on this issue.

    And I did some research. Find some ways for your reference:

    Method 1: Using Query String Parameters

    1. Add a query string parameter to your SharePoint page URL which will contain the URL or title of the page. For example, you can use the following URL: https://yoursharepointpage.com?currentPageUrl=https://yoursharepointpage.com/page1
    2. In your PowerApp, use the Link_to_PowerApp URL to pass query string parameters to the PowerApp. For example, you can use the following URL: https://yourpowerapp.com?currentPageUrl=__currentPageUrl__
    3. In PowerApp, use the Param function to retrieve the value of a query string parameter. For example, you can use the following formula: Param("currentPageUrl")

    Method 2: Using Power Automate

    1. Create a new process in Power Automate and select the "SharePoint - When item is added to list" trigger. Select the SharePoint list where you want to store the URL or title of the page.
    2. Add an "HTTP - Send HTTP Request" action, configure it to use the "GET" method to retrieve the page URL or title from SharePoint. You can use the following URL: _api/web/GetFileByServerRelativeUrl('/SitePages/Page1.aspx')/ListItemAllFields?$select=FileRef,Title
    3. Map the output of the "HTTP - Send HTTP Request" action to the "SharePoint - Update Item" action to update the corresponding item in the list.
    4. In PowerApp, use the "SharePoint - Get Items" action to retrieve the items in the list, and retrieve the value of the page URL or title.

    I hope these steps help you!


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Dave Mack 0 Reputation points
    2023-06-28T08:30:21.1433333+00:00

    Thanks for the ideas.

    I don't think they will help me achieve what I want which was just to capture the current SP page url and pass that somehow with the link to open the PowerApp when the link is selected by the user (ideally via a param value in the QueryString). Then when the App is opened the page url or title will appear as pre populated in the feedback app.

    I will try on the PowerApp forum

    Thanks


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.