cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Display image from Sharepoint Library. Authentication Problem?

Hello,

 I Have an app that loads Images from Sharepoint Library. Images are in a gallery and It works fine when developping the app.

 

However, when its deployed to new devices, the images doesn't show. The only way to make them show is by opening a new tab and opening the sharepoint site which the document library resides in.  (And this is not a one time process. You have to keep doing it from time to time)

 

This is not practical when deplying the app to a large number of devices. 
 What is causing this issue and how can i Fix it?

 

thanks

2 ACCEPTED SOLUTIONS

Accepted Solutions

Hi @Anonymous 

I can confirm that I have just changed 600 images to URI and they now load from my sharepoint list on all devices (Android / IOS) for all users.

View solution in original post

@JMAFO @Anonymous @Mark2457 @Newbie2019 @robinwong 

 

You can view highly compressed and equally high quailty renditions Images or Photos files stored in any Document Library by using the {Thumbnail} property for any given image/photo or file (eg.Word documents,, PowerPoint, HTML files etc) :

 

Assuming you have added a SharePoint Connector to your app associated with Document Library, have added a Gallery control your app associated to that Document Library, you can thereafte simply add an image control to the Gallery and set it's properties as follows:

 

ThisItem.'{Thumbnail}'.Small
ThisItem.'{Thumbnail}'.Medium
ThisItem.'{Thumbnail}'.Large

 

Should you, for example, on selecting a specific row in the gallery whereby a pop-up windows appears containing an larger rendition of that same image/photo in another Image control, all you need to do is set the Image property on that control specifying the following base syntax:

 

Gallery1.Selected.'{Thumbnail}'.Large

 

The URL of the 'returned for sat the '{Thumbnail}'.Large property will look something like as follows:

 

https://...-mediap.svc.ms/transform/thumbnail?provider=spo&inputFormat=jpg&cs=fFNQTw&correlationId=GUID&docid=https%3A%2F%contoso%2Esharepoint%2Ecom%2F%5Fapi%2Fv2%2E0%2Fdrives%2Fb%21LR...Gwl%2Dh...bm%2Fitems%2F01.....HCL%3Ftempauth%3DeyJ…aXw0%26version%3DPublished&width=800&height=800

Note the URL (for a large thumbnail) ends with: &width=800&height=800

 

It is supported, albeit this blog from Chaks (a Senior Program Manager at Microsoft) describes how you can do this with the Graph APIs, this has since been implemented nataively in the SharePoint Connector per my blog post early this year:

https://masteroffice365.com/sharepoint-powered-thumbnails/

 

If you alternatively wish to view an ultra-high quality and equally superbly optimized rendition for any given photo, that by all accounts you'll never even be able to tell the difference between the 0.5Mb - 1Mb maximum size of the rendition compared even a 50Mb file of the original image, you can simply use the substitute function to replace the &width=800&height=800 in the thumbnail URL exposed with whatever values you want. For example:

 

Substitute( Gallery1.Selected.Thumbnail, “&width=800&height=800”, “&width=4096&height=4096” )

The Graph APIs do support specified custom thumbnails size, and as such this really is no different to what you can in case do with the Graph APIs. This technique is simply far easier to implement, and can be entirely dynamically set at runtime as and where you may wish to leverage it. Much like I have done in the lastest blog and corrosponding demo video I've recently published. 

https://youtu.be/vSbwmHfqK3c

https://masteroffice365.com/powerapps

View solution in original post

28 REPLIES 28
v-monli-msft
Community Support
Community Support

Hi @Anonymous,

 

How did you set in PowerApps to make the image show? Did you set below formula in the Image property of the Image control inside the Gallery control?

 

 ‘{Link}’ 

If so, then it is known that this only works in the web version of PowerApps - not on devices. To make it work on devices,  you could try to convert the SharePoint images to its URI (Uniform Resource Identifier) form and bind the image control to that. The URI is basically a long text representation of the image/picture.
Do the following:

  • In SharePoint, create an additional text column in my library and named it 'imageDataUri'
  • In Microsoft Flow, I created a Flow that fires whenever a new SharePoint list item is created, checks to see if the list item is an image (based on the file extension), and if it is, converts its content to its URI format and saves the text in the list items 'imageDataUri' field
  • In PowerApps, instead of binding my image control to the SharePoint image URL, I bound it to the data URI field of the list item instead.

Below is the marked key section of my Flow that does the conversion to the URI format:

flowsp2.png

 

The formula looks as follows:

dataUri(binary(body('Get_file_content')))

The body('Get_file_content') is a reference to the previous step in which you need to fetch the actual content of the file (image in my case) from SharePoint.

 

Regards,

Mona

 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you for the Reply!

 

 er... I Think i failed to mention something..

Well the Images are in a Document Library. But There is a Sharepoint List that has a column called "ImageURL" which contains the URL's of the images in the document library. 

 Ex:
 /*mysite*/Shared%20Documents/Images/1.jpg
 /*mysite*/Shared%20Documents/Images/2.jpg


So inside powerapps, what im doing is just adding a Media > Image

 and for the IMAGE property, im saying "Thisitem.ImageURL

 

shouldn't this work? 
😕

 

And for your method, wouldn't DataURI's size be large as the image's size? 

And I have alot of images in the Document library. 
 The app is just Retrieving the Image related to a dropdown box selection.
Maybe we can use Flow to retrieve the image from the document library using ur method?

 

Thank you again..!

Anonymous
Not applicable

No Solutions?

Anonymous
Not applicable

Hey Aragorn- did you ever find a solution to this? I am having the same troubles as you did with my app.

Hi @Anonymous 

I can confirm that I have just changed 600 images to URI and they now load from my sharepoint list on all devices (Android / IOS) for all users.

JMAFO
Helper V
Helper V

Using the flow to convert the image to URI is extremely slow and causes the image library to no longer open up.. is this expected behavior?

Hi @JMAFO , I had issues with using flow and an image library so placed them all in a standard sharepoint list. The column type is multiple line of text.

 

I used an online convertor as flow was to slow.

 

Cheers

@Newbie2019 thanks for the reply! So to get this clear, you used a standard SharePoint list with the multi line column that stored the data uri and then connected to that list via PowerApps data connection? Did you include the images as attachments on the list?

@JMAFO Yeah, use a standard SharePoint list with a multiline column. I simply click to add a new entry and paste the into that column. For example I called my multi column imageDataURI as below:

URI.JPG

 

I then display the mage in powerapps gallery by doing a lookup based on a name which is displayed against the URI in the title column.

 

Let me know if this works.

 

Cheers

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,509)