Saving photos or images from PowerApps to SharePoint is non easy, but at that spot are workarounds using for example Flow to larn this to piece of occupation equally I’ve written almost previously. The caveat amongst this approach is that when using the photographic boob tube camera command you lot won’t larn total resolution on the images you lot take, but a scaled downward version – as well as adding Flow to the mix increased complexity.
With the recent release of supporting attachments amongst SharePoint lists inward PowerApps it’s directly possible to larn those high resolution photos into SharePoint. But, it’s non straight forward. Even though it’s possible you lot should think it through earlier going total on production amongst this.
Note: This postal service is written based on testing on iOS.
Uploading photos is a mutual inquire when using PowerApps on mobile device. You powerfulness create a reporting application of sorts which supports adding photos equally documentation. My offset idea was to utilize the novel attachment support, pick the photographic boob tube camera equally input as well as hold out done amongst it. Turns out I should goal believing inward fairy tales when a characteristic is but released :). When tapping the “Attach file” link, you lot larn a dialog to browse your iCloud Drive, non an choice to tap into the camera. Which makes feel equally you lot involve an attachment filename. This agency nosotros cannot utilization the default add together attachment functionality.
What I came upwardly amongst was using the “Add picture” command amongst a custom collection, as well as and hence binding the forms attachment command value to this collection. You also involve to reset the class later on you lot modify the collection inward corporation for the modify to hold out picked upwardly inward the command (which is needed for it laissez passer on hold out submitted). The reset has a timing issue, hence I had to add together a timer command which reset’s the class every 1 second. It’s all inward a days industrial plant of duct tape.
Oh well.. let’s construct the application, as well as you lot volition come across for yourself.
Get the sample application!
https://1drv.ms/u/s!AsQPRl4COMyeooI3lfgbLKucjUuw1gStep 1 – Create a SharePoint list
First you lot involve to create a SharePoint listing supporting attachments equally your information store. You tin add together whatever number of columns equally needed for storing captured data, but I’ll stick amongst championship alone for this sample.
Step 2 – Create the App
As I’ll hold out testing this on my recall I picked a blank recall layout. For the screen’s OnVisible outcome add together the next formula to clear our paradigm collection on start or if you lot get got a multiple cover logic. Adapt equally you lot come across fit. (See my sample application for to a greater extent than details).
Clear(ImageCollection)
From the View tab I click information sources as well as pick my “Attachments” SharePoint list.
From the Insert tab add together an Edit class as well as bind it to the Attachments information source. I renamed my class from Form1 to AttachmentForm for readability.
De-select all listing fields except Title as well as Attachments.
Next modify the default way of the class from Edit to New.
Add an paradigm control
Outside of the Form, add together an “Add picture” command which volition hold out used to capture images using your device camera.
Next modify the formula for the paradigm command group’s OnSelect outcome to:
Collect(ImageCollection,{DisplayName:Concatenate("image",Text(CountRows(ImageCollection)+1),".jpg"),Value:UploadedImage1.Image,AbsoluteUri:"",Id:"00000000-0000-0000-0000-000000000000"})
What happens is that nosotros add together a row for the attachments amongst the fields:
- DisplayName – filename of the attachment, must hold out unique
- Value – binary information of the image
- AbsoluteUri – blank, volition hold out develop past times SharePoint
- Id – Influenza A virus subtype H5N1 guid, volition hold out develop past times SharePoint
The offset portion generates a unique filename for the attachment imageX.jpg, where X is the attachment number starting from 1, as well as nosotros develop the value to request to the AbsoluteUri holding of the paradigm control. Internally this volition request to the binary blob. (I figured out the information format amongst some playing roughly equally it’s non documented).
Select the AddMediaButton1 control, as well as develop ChangePictureText to the same text equally the default text equally we’ll hold out supporting multiple images:
Binding the attachment listing to the custom collection
Select the information menu for the attachments as well as unlock it.
After unlocking the control, modify the Items holding to hold out fountain to ImageCollection instead of Parent.Default.
By default the command accepts half dozen attachments which you lot tin change. The max attachment size of 10mb is a difficult confine inward the electrical current version, hence this should hold out left equally is.
Next unlock the championship field, as well as develop the default value to a text of your choice.
This modify powerfulness seem weird equally all SharePoint items volition get got the same title. Since the championship champaign is required, as well as inward the adjacent footstep you lot volition hold out adding a reset class timer to overcome a timing issue, this is a workaround to brand certain the item has a title. You tin re-work inward a duo of dissimilar ways:
- Make championship non-mandatory, as well as enshroud it from the appå
- Add a custom championship champaign which you lot bind to a context variable, as well as and hence bind the higher upwardly command to that context variable.
- (Figure out some other way to cook the timing number to update the paradigm collection)
Adding a timer to refresh the attachment list
On the cover sail add together a timer control, as well as configure the properties equally follows:
- Duration: 1000
- AutoStart: true
- Repeat: true
- OnTimerEnd: ResetForm(AttachmentForm) <- or whatever cite you lot get got on your form
Without this timer there’s a timing number for when the collection updates as well as binding of ImagesCollection to the attachment command inward the app.
I tried adding it earlier submit or later on the paradigm was taken, but ran into issues where it wouldn’t pick upwardly all photos taken.
Adding a clear images push as well as submit button
Add a push named Clear amongst the next formula for OnSelect:
Clear(ImageCollection)
Add a push named Submit amongst the next formular for OnSelect:
SubmitForm(AttachmentForm);Clear(ImageCollection)
Testing the app
You should directly get got an app looking similar to the paradigm below, amongst some tidying up.
Here’s a brusque video testing the app on my iPhone, adding 2 photos.
Heading over to the SharePoint listing I directly get got 1 listing entry amongst 2 attachments.
Next steps
To brand the app to a greater extent than polished you lot can:
- Add a start cover to your app
- Hide the timer control
- Hide the attachment card
- Add an paradigm gallery showing the photos you lot convey binding it to ImagesCollection
- Create a Microsoft Flow which takes each attachment as well as saves to a dissever document library
Summary
Although saving a collection of native photographic boob tube camera images from PowerApps to SharePoint is yet non super simple, it is doable, as well as you lot don’t involve Microsoft Flow. We also come across that PowerApps is changing as well as novel functionality is beingness added – hence mayhap inward some nigh or distant time to come nosotros tin utilization a device photographic boob tube camera to capture native hullo resolution images inward PowerApps, as well as easily salvage them to SharePoint, either straight or via a non likewise complex Flow.
Happy PowerApping!
Thanks for reading : A Workaround For Saving Hi-Res Photos From Powerapps To Sharepoint