I have a list of image URLs (hosted in sharepoint) which I am showing in a gallery. However in some cases the user might not have access to the image or the image is not available, in which case i want to show a default image or hide the image control. I cannot find a way to see if the image is 'viewable' by the end user. Tried getting the Image Binary but all i get is the URL. Also tried a PowerAutomate flow but that uses a service account which will always have access.
any ideas how this can be achieved??
In that case you might need to integrate powerautomate for sending HTTP request which sends 200 status response back when the image is accessible
i have tried this approach but the Office365Users.MyProfile().DisplayName does return the name even though the browser session is not authenticated to sharepoint, so it does not work unfortunately.
I understand the scenario better now. If users have access to the images but might not be authenticated to SharePoint in the browser, you can try implementing a method within PowerApps to authenticate the users before displaying the images. Here's a possible approach to handle this situation:
Use the SharePoint connector in PowerApps to fetch the images directly from SharePoint without involving a flow.
Wrap the image control in a container (e.g., a group) in PowerApps.
Set the container's Visible property to a condition that checks if the user is authenticated to SharePoint. You can use the Office365Users connector to check the user's status.
For example, you can use the following formula to check if the user is logged in to SharePoint:
Office365Users.MyProfile().DisplayName
If the user is not authenticated, this formula will return blank. You can use this property to set the visibility of the container:
If(
IsBlank(Office365Users.MyProfile().DisplayName),
false, // Not authenticated, hide the container
true // Authenticated, show the container with the image control
)
Add a default image control (or a blank image) within the same container, placed behind the actual image control. This way, when the user is not authenticated, they will see the default image or a blank area.
When the user is authenticated, they will see the actual image control placed above the default image control, effectively hiding the default image.
By following this approach, the users will see the default image or a blank area in the gallery when they are not authenticated to SharePoint. If they try to open the image URL directly in the browser, SharePoint will prompt them to authenticate, and once authenticated, they can see the actual image within the PowerApps gallery.
Keep in mind that this approach doesn't directly force authentication within PowerApps, but it gives you a way to handle the visibility of images based on the user's authentication status. It's essential to properly communicate to users that they need to access the images through the PowerApps app to avoid confusion if they encounter authentication prompts when opening the image URLs directly.
My biggest issue with using flow is that in reality users always have access to the images however they might not be authenticated to sharepoint in the browser. that means that if a blank comes up and the user opens the url directly in the browser, the authentication screen will come up, user logs in and then they will also see the image in Canvas. Is there a way to force the authentication in POwerApps maybe?
HI @deg85 ,
In PowerApps, there isn't a built-in function or direct method to check if a user has access to an image URL, as it's generally intended to focus on the app's user interface rather than handling user permissions. However, you can try a workaround to handle this situation using the following approach:
Create a Power Automate Flow:
Modify PowerApps to check image accessibility:
This workaround leverages Power Automate's ability to access the SharePoint URL and check for accessibility, which is not directly available in PowerApps. Keep in mind that using a flow to handle this might introduce some delay due to the round-trip to the flow and back to PowerApps. However, it should help you handle the scenario where users may not have access to certain images.
Remember that this workaround is not a foolproof solution for handling all scenarios, especially if the user's access to SharePoint is more granular and complex. It's essential to design the SharePoint access and permissions structure carefully to ensure the best user experience in PowerApps.
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
Super User 2025 Season 2
mmbr1606
275
Super User 2025 Season 2