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

Attach File not saving to sharepoint list

I have a form connected to a sharepoint list. When the user clicks the camera button, it opens a form with a camera control and when that control is clicked it uses the GUID() variable and adds it to a collection that is shown in a gallery (item set to this variable). The attachments Data Card has Default and Update both set to this same variable. 

 

But when I add a file (click paperclip inside the attachments data card), the attachment appears in my gallery but does not save to the sharepoint list when I SubmitForm. So when I re-open, the pictures are there but the attachment is not. If save an attachment only and check the back-end (sharepoint list) it does not save.

 

If I change Update to DataCardValue13.Attachments (DataCardValue13 is inside the attachments data card), the attachments save to sharepoint, but the pictures do not.

 

How can I save pictures and attachments?

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @kevinK ,

You need two attachment controls - one set for each purpose. You can put them in the same card and make whichever one Visible as required. You then update the card with whichever one is visible.

 

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.

Visit my blog Practical Power Apps

View solution in original post

5 REPLIES 5
WarrenBelz
Super User
Super User

Hi @kevinK ,

You need two attachment controls - one set for each purpose. You can put them in the same card and make whichever one Visible as required. You then update the card with whichever one is visible.

 

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.

Visit my blog Practical Power Apps

WarrenBelz
Super User
Super User

Hi @kevinK ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

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.

Visit my blog Practical Power Apps

kevinK
Regular Visitor

Hi @WarrenBelz ,

 

Thanks for the response ... This works if I only have one image collection and one attachment screen... 

 

My form has a tab called "Problem" and a tab called "Repair". Each tab has a camera icon that navigates to a new screen that has a camera control in it. So when the camera icon in the "Problem" tab is clicked, it sets a variable called "ProblemImage", and OnSelect of the Camera control there is an if statement that says if varPictureTab = "ProblemImage", collect(colProblemImages, ...), and the false part of the if statement says varPictureTab = "RepairImage", collect(colRepairImages, ...). The variable setting is working, because each gallery is showing the respective pictures (Gallery items = colProblemImages, and the other one is items = colRepairImages), but when I SubmitForm, nothing is saved. I tried inserting 3 attachment controls inside the attachment tab. One of those controls has Items = colProblemImages, the other one Items = colRepairImages, and the other is Items = Parent.Default, but it still isn't saving the attachments (only works if I have 1 collection)...

 

Is there a way to do this? Or maybe there is a way to append the "ProblemImage" and "RepairImage" variable to the attachment name and filter each gallery. That way I could have only one collection and still show images associated with each tab?

Hi @kevinK ,

To be honest, I would (on do on my apps) be saving all the photos in a Library, where you can add metadata including notes and multiple categories so you can file and retrieve them as required. Attachments are good for simple structures (they are one) and I think you are "pushing the envelope" a bit too far here. I have a blog that may assist you 

 

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.

Visit my blog Practical Power Apps

 

 

 

kevinK
Regular Visitor

I was able to use 1 gallery for images, and filter Data Items for each gallery. So my ProblemImages gallery Items = Filter(colImages,Left(DisplayName,7) = "Problem"

 

When the user clicks on the camera icon on the Problem tab, it sets a variable that is called "ProblemImage". Similarly on the Repair tab, the variable is called "RepairImage". That variable is used to set the Display Name, which is appended with now() to differentiate file names. So every attachment name starts with with either ProblemImage or RepairImage. The filter is using the first part of that Display Name.

 

It worked great. I'll accept the first part as the solution because adding the second attachment control enabled me to save pictures and files to the Sharepoint list. The filtering described above is an alternative to using a document library and workflow. 

 

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,262)