Hey there!
It sounds like you're in a bit of a pickle with your Power App and SharePoint connections, especially trying to keep things speedy and user-friendly for both your sub-companies. It's awesome that you're aiming for a single app experience!
That "switch prior Document connector" idea for different SharePoint connections is definitely a common first thought, but as you've found, it doesn't always play nice. And you're spot on—using Power Automate (Flow) for a direct HTTP request to SharePoint is usually the way to go for better performance, especially when you need to filter data efficiently.
Let's dive into why your current HTTP request might be a bit off and how to get it humming!
The Sneaky Culprit: SharePoint Column Internal Names
You're using _api/web/lists/getbytitle('Dokumente')/items?$filter=Info ne null, which should work for a "not null" filter. However, the most frequent reason this goes awry is because of SharePoint column names. When you create a column with a friendly display name like "Info," SharePoint often assigns it a slightly different internal name behind the scenes. And for REST API queries, you must use that internal name.
Sometimes, SharePoint might append numbers (like Info0) or adjust the name if you've had columns with similar names before.
How to Find the True Internal Name
This is super important! Here's how you can dig it up:
-
Navigate to your 'Dokumente' document library in SharePoint.
-
Click on the gear icon (⚙️) in the top right, then select "Library settings."
-
Under the "Columns" section, click directly on your "Info" column.
-
Now, look at the URL in your browser's address bar. You'll see something like .../Lists/Dokumente/Settings.aspx?Field=YourInternalColumnName. That string right after Field= is your column's internal name.
For example, if the URL shows Field=Info0, then Info0 is the internal name you need to use.
Crafting the Perfect HTTP Request
Once you have that exact internal name (let's call it YourInfoInternalName for now), you'll plug it into your query:
_api/web/lists/getbytitle('Dokumente')/items?$filter=YourInfoInternalName ne null
Boosting Performance Even More with $select
To make things lightning fast, tell SharePoint exactly which columns you want back. This reduces the amount of data transferred. If you only need the document's Title, its FileRef (for the direct link), and your Info column, your request would look like this:
_api/web/lists/getbytitle('Dokumente')/items?$select=Title,FileRef,YourInfoInternalName&$filter=YourInfoInternalName ne null
Setting Up Your Power Automate Flow (The Better Way!)
Here’s a breakdown of how to structure your flow to handle both companies efficiently:
-
PowerApps (V2) Trigger: Start with this. Add an input for CompanyName (Text) so your Power App can tell the flow which company's SharePoint to hit.
-
Condition Action:
-
Inside the 'If yes' branch (for Company A):
-
Inside the 'If no' branch (for Company B):
-
Action (After the condition, common to both paths): Parse JSON
-
Content: This is where you grab the results from your HTTP request. You'll likely use an expression like body('Send_an_HTTP_request_to_SharePoint')['d']['results'] (adjust the action name if you have multiple 'Send an HTTP request' actions).
-
Schema: The easiest way to get this is to run your flow once successfully with a good HTTP request. Then, copy the JSON output from the "Send an HTTP request" action, and in the Parse JSON action, click "Generate from sample" and paste your copied JSON. This creates the perfect schema.
-
Action: Respond to a PowerApp or Flow (V2)
-
Add an output of type Array.
-
Name: DocumentData (or something similar).
-
Value: body('Parse_JSON') (this passes your parsed document data back to Power Apps).
Bringing it All Together in Power Apps
-
Add your Flow: In Power Apps, go to Data -> Add data -> Flows and connect your newly created flow.
-
Call the Flow: When a user selects their company or when the app loads, call your flow:
ClearCollect(colDocuments, YourFlowName.Run(YourCompanyNameVariable))
Replace YourCompanyNameVariable with whatever you're using in your app to identify the user's company (e.g., from a dropdown, user profile, etc.).
-
Display Your Documents: Now you can populate a Gallery control with colDocuments. Inside the gallery, you'll access the properties directly:
-
ThisItem.Title (for the document name)
-
ThisItem.FileRef (this is the full path, perfect for opening PDFs!)
-
ThisItem.YourInfoInternalName (to display the "Info" column content)
Why HTTP Request Wins (Speed!)
You're absolutely right to go for the HTTP request! The built-in "Get files (properties only)" action, while convenient, often does a lot more processing in the background. A direct HTTP request, especially when you use $select and $filter, talks straight to SharePoint's API. This means less data transferred and much faster load times for your users – exactly what you need when dealing with documents!
Give this a shot, and let me know if you run into any specific errors or need more help tweaking that HTTP request. You're definitely on the right track!
If you found this helpful, please mark this as the verified answer! It'll help others in the Power Platform community find this solution too.