- June 27, 2024
- Posted by: Barathi Raja
- Categories: Power BI, Sharepoint
In this blog, we’ll look at how to display images from SharePoint site that require authorization in paginated report. We can’t directly do it in paginated report as its authenticating SharePoint images. These images will be stored in Power BI dataset in base64 format then it will be referred in paginated report. `
Let’s look at the following real-time scenario, in which we need to display every service provider’s details in a paginated report that pulls images data from SharePoint. When we directly access that SharePoint image in paginated report, it will throw below error (Refer to figure 1.0)
Figure 1.0
Step 1:
Get the SharePoint images in power BI desktop
Figure 1.1
Step 2:
- Go to power query editor to convert the images from binary to base64 format
Figure 2.1
2. Right click Content column then change the data type to text. Base64 is the text format of binary.
Figure 2.2
Figure 2.3
3. If the image is big, need to split this base64 column by 32766 characters as power bi has the limitation to read characters in a single cell.
Figure 2.4
4. Save and publish this dataset into power BI service.
Step 3:
- Add dataset in paginated report with published power bi dataset
- Insert the images, select database in Image source field and then choose MIME type
Figure 3.1
3. Update the below script in expression of ‘Use this field’ (Refer to Figure 3.2)
=System.Convert.FromBase64String(Fields!Content.Value)
Figure 3.2
4. For the big images, All the splitted base64 columns need to be combined in Pagined report using below script
=System.Convert.FromBase64String(Splitted column1 + Splitted column 2+ Splitted column 3+….)
5. Click Ok and render the report. Now we can see the SharePoint images in Paginated report.
Final Report:
Figure 3.3
Conclusion
We can see images from SharePoint site that require authorization in paginated report as shown in the above result image. Please feel free to reach Cittabase for more information. Visit our blogs for more topics on Power BI & Paginated report.