dm-p / powerbi-visuals-html-content

Visualise column or measure values as HTML in your Power BI reports. Intended as a spiritual successor to the OG HTML Viewer custom visual, with some extra stuff thrown in.
MIT License
85 stars 18 forks source link

[BUG] Sharepoint imagesURL stopped showing in PBI server #106

Closed kimnegrette3 closed 6 months ago

kimnegrette3 commented 7 months ago

I'm using the regular HTML content visual in PBI to show some images stored in a sharepoint folder. Edit access is granted for me and report users. Until last week, the images where showing perfectly in PBI server (not in desktop), but suddenly they just stopped showing and I have not changed the measures or anything. The URL link works perfectly in the browser.

This is an example of the DAX measures I'm using in the visual: BRIX-eComm =

VAR MaxDateeCommFedex = CALCULATE( MAX('Others_Slides & Maps'[Date created]), 'Others_Slides & Maps'[File Name] = "BRIX-eComm-Fedex-WM&Sam.jpg" ) VAR LatestImageURLeCommFedex = CALCULATE( SELECTEDVALUE('Others_Slides & Maps'[Image URL]), 'Others_Slides & Maps'[Date created] = MaxDateeCommFedex, 'Others_Slides & Maps'[File Name] = "BRIX-eComm-Fedex-WM&Sam.jpg" ) RETURN IF( LatestImageURLeCommFedex <> BLANK(), "<img src=""" & LatestImageURLeCommFedex & """ style='max-height:500px;max-width:1160px;object-fit:contain;' />", "Image not available" )

I've tried giving a simpler measure, even the direct src with the link, but none is working. I'd greatly appreciate if you could help me understand what could go wrong. Thanks in advance!

**Power BI Setup

**Visual Information

dm-p commented 7 months ago

If they have suddenly stopped working, it suggests that permissions have changed at the SharePoint end. Have you confirmed if the SharePoint admins have made any potentially breaking changes to permissions that coincide with the time the images stopped displaying?

While you might have Edit access in SharePoint, note that custom visuals do not pass through authentication or session information elsewhere due to security restrictions, so it will not authenticate against SharePoint on your behalf. Any images need to be publicly available or SharePoint will need to allow anonymous access to these resources.

While the URL might work for you in the browser, were you signed in when you tested? If so, it might be worth checking in a private/incognito browser session to see if the URL still comes up. If the URL cannot be accessed when unauthenticated or as an anonymous user, the visual will not be able to display it and this may help zero in on why things stopped working.

At this point, you will need to work with your SharePoint admin to make the images available publicly. If this is unacceptable regarding SharePoint access policies, you may need to find an alternate location or see if you can import them to the data model as base64 representations. Bear in mind that there are some limitations in the data model with respect to image size and columns, and there are techniques that you can employ to try and mitigate this.

If anonymous access works for these images in your browser, I might need more info to help diagnose, as HTML Content hasn't had any updates for a while, so this means that something in Power BI might have changed, and we may need to speak with MS about what might have gone wrong here.

kimnegrette3 commented 7 months ago

Thank you very much for your help! Indeed the image URL was not working in incognito, although I did not try this last week when the images where showing correctly. The suggestion of importing the images in the data model as base64 worked perfectly. So I should assume that something just changed in the access policies of sharepoint, right? Thank you again, it was very helpful!

dm-p commented 6 months ago

Glad to hear things are working for you :)

I would assume that the SharePoint policies had been changed, but the best way to confirm would be to check with the admins to see if they had made any changes to permissions.

However, as this is working OK for you as a solution, I'll close this as completed. Thanks for using HTML Content!