cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
RossBroadley
Level: Powered On

Images sent to sharepoint via microsoft flow not displaying in sharepoint.

Hi guys, 
Currently developing an app where I must upload images to sharepoint. To achieve this I have created and implemented a flow based on the "Upload an image to sharepoint" template. The flow runs, and even uploads the stored image (Stored in variable).
However, when I open the created record the images display as a black box with a white outline. 
When I download the image, there is something in the file. But it shows as blank in photos. 

Really confused as to what's going on. 

Codes:

File Name Flow Expression:
triggerBody()['CreatefileFilename']

File Content Flow Expression:

dataUriToBinary(triggerBody()
['CreatefileFileContent'])

Code for storing image in variable:
UpdateContext({TakenPic: Camera1.Stream})

On Select code for executing flow
UploadImage.Run('Short Description'.Text & ".JPEG", TakenPic)




9 REPLIES 9
Super User
Super User

Re: Images sent to sharepoint via microsoft flow not displaying in sharepoint.

First, I assume from the screenshot that you are taking the image using the camera, and not acutally uploading an image file.  Uploaded image files require a different strategy.

Second, are you actually storing the image as a variable or using a collection?  I've done this successfully, but always used a collection to store the filename and the photo itself.  Then passed those two parameters to the Flow as you are doing.  

Everything else looks right.  But I would try saving the photo as a collection record rather than a variable. Like this

Collect(mypics1,{Title:TextInput1.Text,Pic:Camera1.Photo})

Then invoke the flow like this

'SaveImage'.Run(First(mypics1).Title,First(mypics1).Pic)


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted
RossBroadley
Level: Powered On

Re: Images sent to sharepoint via microsoft flow not displaying in sharepoint.

Hi Pstork1, 

Yes, the images being uploaded are from the camera. And not an image file. Only one image was uploaded by an image file and that was as a test after I realised something was wrong! 

Also, I am storing the image using a variable. The variable is called TakenPic. To make sure this was working, I added an image control where I passed the variable to display TakenPic.

Interesting! I never thought of using a collection as part of the flow. I've tried to patch the image from a collection directly, but it was just a headache. (Hence why I have settled on using flow instead) 
I will give your suggestion a go and get back to you. 

Thank you very much for your response!

RossBroadley
Level: Powered On

Re: Images sent to sharepoint via microsoft flow not displaying in sharepoint.

Hello again, 
I was able to give your suggestion a try. But I think I've done something wrong. The flow is now failing to run. (See below for full error) 
The code I added is:
Take Photo Button:
Collect(mypics1,{Name:'Short Description'.Text,Pic:Camera1.Photo})
Run Flow Button:
UploadImage.Run(First(mypics1).Name & ".JPEG",First(mypics1).Pic) 
I have tried the button without the ampersand, still receive the same error.

The error in flow says:
"Unable to process template language expressions in action 'Create_file' inputs at line '1' and column '1925': 'The template language function 'dataUriToBinary' expects its parameter to be formatted as a valid data URI. The provided value '' was not formatted correctly. Please see https://aka.ms/logicexpressions#dataUriToBinary for usage details.'."

Super User
Super User

Re: Images sent to sharepoint via microsoft flow not displaying in sharepoint.

Here's a picture of the Flow that works for me.  Make sure its set up to pass two parameters.

screenshot.png

You'll notice that I'm doing the DataURI conversion and storking that using Compose rather than trying to do it in the File Content Property itself.  That could also be your problem.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
RossBroadley
Level: Powered On

Re: Images sent to sharepoint via microsoft flow not displaying in sharepoint.

It seems we're making progress. 
The flow is still failng to execute, but for a different reason this time. 
I'm getting the error:
'The template language function 'dataUriToBinary' expects its parameter to be formatted as a valid data URI. The provided value 'Tester' was not formatted correctly.
I got the same error when I had the ampersand with .jpeg also. 
Image is from the camera control, so I'm confused as to why it's not recognising it as a valid URI. 
ComposeFlow.PNG

Strange...

Super User
Super User

Re: Images sent to sharepoint via microsoft flow not displaying in sharepoint.

The & ".jpeg" was to make sure it had a jpeg extension on the filename when you created it.  Otherwise SahrePoint wouldn't recognize it when you tried to open it.  If it thinks the Data URI you passed was "Tester" then I suspect you are passing the wrong parameter or passing them in the wrong order.  If you look at the collection do you actually see the photo?  If you do then the data is there, but its not being passed right.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
RossBroadley
Level: Powered On

Re: Images sent to sharepoint via microsoft flow not displaying in sharepoint.

I have just checked the collection and it seems that the image is there. collection.PNG
Does the collection look how it should? 

Super User
Super User

Re: Images sent to sharepoint via microsoft flow not displaying in sharepoint.

Not really.  It should look something like this

screenshot.png



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
RossBroadley
Level: Powered On

Re: Images sent to sharepoint via microsoft flow not displaying in sharepoint.

Ahhh ha! Now we know where the issue is. It had nothing to do with flow. It has to be something to do with the camera control not capturing images correctly. 
Wonder if it's something to do with the streamrate? I have it set to 100.
What I think I'll try is redoing the camera controls.

Really appreciate all of the assistance on this by the way! 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Tomorrow, September 18th at 8am PDT

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 218 members 4,554 guests
Please welcome our newest community members: