web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id : jWYoWb9xTz2kU2oPT7W9Gl
Power Apps - Building Power Apps
Unanswered

CanvasApp: Getting the binary data of Images defined as a URL

Like (0) ShareShare
ReportReport
Posted on 27 Jul 2023 07:09:38 by 85

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??

Categories:
  • JatinSaini Profile Picture
    428 on 27 Jul 2023 at 10:38:07
    Re: CanvasApp: Getting the binary data of Images defined as a URL

    In that case you might need to integrate powerautomate for sending HTTP request which sends 200 status response back when the image is accessible 

  • deg85 Profile Picture
    85 on 27 Jul 2023 at 10:18:17
    Re: CanvasApp: Getting the binary data of Images defined as a URL

    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. 

  • JatinSaini Profile Picture
    428 on 27 Jul 2023 at 08:23:21
    Re: CanvasApp: Getting the binary data of Images defined as a URL

    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:

    1. Use the SharePoint connector in PowerApps to fetch the images directly from SharePoint without involving a flow.

    2. Wrap the image control in a container (e.g., a group) in PowerApps.

    3. 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.

  • deg85 Profile Picture
    85 on 27 Jul 2023 at 08:17:36
    Re: CanvasApp: Getting the binary data of Images defined as a URL

    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?

  • JatinSaini Profile Picture
    428 on 27 Jul 2023 at 08:12:48
    Re: CanvasApp: Getting the binary data of Images defined as a URL

    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:

    1. Create a Power Automate Flow:

      • Create a new Power Automate flow triggered by a request from PowerApps.
      • In the flow, use the SharePoint connector and configure it to get the image from the URL provided in the request.
      • Implement a condition to check if the image can be accessed. You can do this by checking if the HTTP response status code is successful (e.g., 200 OK) or not.
      • If the image is accessible, return the image URL as the response. Otherwise, return a flag or some indicator to identify that the image is not accessible.
    2. Modify PowerApps to check image accessibility:

      • In PowerApps, call the Power Automate flow using the 'Power Automate' connector when you need to display an image from the SharePoint URL.
      • In the flow's response, you will get either the image URL (if it's accessible) or a flag/indicator (if it's not accessible).
      • Based on the response, you can then choose to display the image in the gallery if it's accessible or show a default image/hide the image control if it's not accessible.

    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.

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2