cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SamTimmins
Regular Visitor

Camera and Uploading Images using Flow

Hi All,

 

I'm quite new to PowerApps and am using the Site Inspector template to learn and play. 

 

One of the things I would like to learn with it is to upload the images and descriptions to SharePoint and a network location with Flow/Power Automate.

I've created the Flow, however, I don't quite understand the logic for parsing the parameters to it, and whether it is possible to include this flow process as part of the 'Save' button which currently runs SubmitForm(FormNewInspection)

 

Would someone be able to provide some explanations around the CameraPhotos and whether this is possible?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

OK thanks @SamTimmins ,
This is one of the less complex items.
Firstly I will explain the process on the various controls. Note there any many different ways of doing this and this is one of the simpler ways that work.
Firstly, the OnSelect of the Camera Control (I will call it CameraBox)

 

ClearCollect(colPhoto, CameraBox.Photo)

 

This stores the image in a collection called colPhoto. I will deal with single images here, but you can store and send multiple at a time instead of each one separately.
To preview the photo, insert an Image Control with the properties

 

First(colPhoto).Url

 

Now to the Flow.

 

  • Choose New > Instant from Blank, give it a name (my example is FilePhoto) and choose PowerApps as the trigger.
  • Choose New Step > SharePoint > Create File
  • Add your site and folder and then Ask in PowerApps for the File name and File content

It will then look like the below the PhotoFlow1 file attached.
The next part is a bit tricky

  • Delete the file content bit for then moment, click on Expression at the right and type in dataUriToBinary(
  • The other bracket will appear - select Dynamic Content and put back in the item in the box at the bottom
  • The text should now say dataUriToBinary(triggerBody()['Createfile_FileContent']) - click OK. You can actually type this into the Expression if you want. It should now look like PhotoFlow2 attached.
  • Save the Flow - you are now finished with it.

Now back at PowerApps, attach the Flow to a button on the OnSelect property choose from top menu -  Action > Power Automate the choose the Flow from the list. Your command line should now say FilePhoto.Run(   if that was the name you used.
I will call your file name Test.jpg you will need to substitute whatever you use. so the code will end up

 

FilePhotoRun("Test.jpg",First(colPhoto).Url)

 

This will send a photo from the camera to a file called Test.jpg to your SharePoint Library.

 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

11 REPLIES 11
WarrenBelz
Super User
Super User

Hi @SamTimmins ,

Are you wanting to add these as images to a SharePoint library or as Base64 text to a SharePoint List.

Also are you taking them on a device camera or uploading them from a file?

There are different process for all of these - I just need to know which one to address.

Hi @WarrenBelz ,

 

Adding to a SharePoint library. 

The images are taken on the device camera.

 

Thanks!

WarrenBelz
Super User
Super User

OK thanks @SamTimmins ,
This is one of the less complex items.
Firstly I will explain the process on the various controls. Note there any many different ways of doing this and this is one of the simpler ways that work.
Firstly, the OnSelect of the Camera Control (I will call it CameraBox)

 

ClearCollect(colPhoto, CameraBox.Photo)

 

This stores the image in a collection called colPhoto. I will deal with single images here, but you can store and send multiple at a time instead of each one separately.
To preview the photo, insert an Image Control with the properties

 

First(colPhoto).Url

 

Now to the Flow.

 

  • Choose New > Instant from Blank, give it a name (my example is FilePhoto) and choose PowerApps as the trigger.
  • Choose New Step > SharePoint > Create File
  • Add your site and folder and then Ask in PowerApps for the File name and File content

It will then look like the below the PhotoFlow1 file attached.
The next part is a bit tricky

  • Delete the file content bit for then moment, click on Expression at the right and type in dataUriToBinary(
  • The other bracket will appear - select Dynamic Content and put back in the item in the box at the bottom
  • The text should now say dataUriToBinary(triggerBody()['Createfile_FileContent']) - click OK. You can actually type this into the Expression if you want. It should now look like PhotoFlow2 attached.
  • Save the Flow - you are now finished with it.

Now back at PowerApps, attach the Flow to a button on the OnSelect property choose from top menu -  Action > Power Automate the choose the Flow from the list. Your command line should now say FilePhoto.Run(   if that was the name you used.
I will call your file name Test.jpg you will need to substitute whatever you use. so the code will end up

 

FilePhotoRun("Test.jpg",First(colPhoto).Url)

 

This will send a photo from the camera to a file called Test.jpg to your SharePoint Library.

 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

Hi @WarrenBelz ,

 

Thanks for the response - that makes a bit more sense now. 

 

I've created a blank app and tried those suggestions, I have a couple of other questions though: 

  • When I use the button to attempt the flow it fails (see attached images). I believe this is because it is only asking for one parameter, whereas your example the FilePhoto.Run() asks for two? 

 

  • Do you have much familiarity with the Site Inspection Microsoft template? I know it's quite a bit more detailed but I'd love to know if there is a way to easily combine the 'Save' button (which currently submits the form) so that it also launches the flow - uploading the gallery/photo images.

 

Cheers,

HI @SamTimmins ,

Firstly, what is the Create file action with the green icon - it should be a SharePoint - Create file blue icon as per my first post.

JPGSaveError.pngPhotoFlow2.png

 

 

 

 

 

 

 

 

 

 

 

 

 

The Flow should ask for two parameters, the first being the file name and the second the photo First(colPhoto).Url . The flow failed because you sent a string "Test.jpg" as the file content and possibly also because of the connector.

Regarding your second question, no I have never used that template.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @WarrenBelz , 

 

The green create file is for a network/file server share. I've created other flows using it before and was experimenting with it here. 

I assumed it wouldn't make much of a difference, however I did have the SharePoint step as an alternate step with the same issue. 

 

The call in PowerApps is definately only asking for one parameter however, I've tried to delete and recreate it with the same issue.

 

Any ideas why that might be?

Hi @SamTimmins ,

Have a look at the exact code in your Create File. (dataUriToBinary( . . . .)

The SharePoint example will certainly not work with Create File 2 unless you have this in the component converted.

Hi @WarrenBelz ,

 

This is the exact code after I've deleted the flow and recreated again fresh: 

 

dataUriToBinary(triggerBody()['Createfile_FileName'])

 

Hi @SamTimmins ,

I was having a good day that day . . .

dataUriToBinary(triggerBody()['Createfile_FileContent'])

I was at the end of the post and pulled in the wrong content - I have adjusted my original so anyone starting there will not have to go through the journey.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.  

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,217)