'In PowerApps or PowerAutomate, how do you detect what website you are on?

I want to build a PowerApps application that I can drop into any SharePoint site collection. For example, I want to query all the SharePoint lists in the current subsite.

In a C# WebPart, I can use the SPSite or SPWeb object.

In JavaScript, I can use Request.Url and parse the website (site collection) or even the specific page from that URL.

I know I can use a SharePoint connector and hardwire my Application to a specific site. But then I have to build an identical Application for EVERY site I manage, and that's hardly efficient. I want a single Application that dynamically figures out where it has been deployed to.

If I can read the URL of my host page, just like in JavaScript, from that URL, I can determine if it's a SharePoint Site and then do a REST query to get the data I want.

How do I tell where my Application currently sits?

I am open to a solution in PowerApps, or a PowerAutomate Flow, whichever offers the functionality.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source