Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Saving attachments from entry to collection list

(0) ShareShare
ReportReport
Posted on by 395

Hi,

 

I have an offline app that saves to a collection (KBZcollection), then uploads to a sharepoint database. I have all the required fields working except for attachments. The app captures individual records such as name, customer, etc and requires attachments to be saved for each record and uploaded to sharepoint. 

I was able to copy and paste an attachment control to my collection edit screen (copied from creating edit form, connected to sharepoint and copying attachment control from there) and have tried to add attachment to the collection list, then patch it to sharepoint with no luck. Can anyone please assist on the best option to achieve this. Thanks

e.g. used Collect(KBZCollection, {Attachments: Attach.Attachments}
then using ForAll(KBZCollection, Patch(KBZoffline, Defaults(KBZoffline),{KBZattach: KBZattach}))  

  • Re: Saving attachments from entry to collection list

    Hi @Matt383 ,

    1)Do you set one field named Id as required in your sharepoint list?

    If yes, please set this field to not required.

    2)No, please do not use Patch function to submit attachments.

    It's only supported to use submitform function to submit attachments.

     

     

    Best regards,

  • WarrenBelz Profile Picture
    WarrenBelz 145,445 on at
    Re: Saving attachments from entry to collection list

    Hi @Matt383 ,'

    What exactly are you trying to do with the appres://blobmanager/0ff18ae33bbd4b....?

    A Library has a built-in function Thumbnail, which is mentioned in the blog for viewing.

  • Matt383 Profile Picture
    Matt383 395 on at
    Re: Saving attachments from entry to collection list

    Hi Warren,

     

    Thanks for the information. The only problem i am having is with the flow getting the image file into the right place. I can get the powerflow to convert the image to the ImageList within Sharepoint, however, i have a sharepoint list with numerous fields and require the image file to go to the same location as the appres://blobmanager/0ff18ae33bbd4b.... I have named the column title in my Collection as "Image" and have a sharepoint column, "Image" and can get the blobmanager version in there, just cant seem to find how to get the powerflow version in there. Any advice would be much appreciated.

    Kind regards,

    Matt

  • Matt383 Profile Picture
    Matt383 395 on at
    Re: Saving attachments from entry to collection list

    I have followed the procedure and the attachment control in form 1 saves to collection, however, when attempting to submit in form 2, message appears below Attachments control saying  'Field 'Id' is required'  I have the buttons onselect to SubmitForm(Form2), Do i need to patch to the sharepoint list something like ForAll(KBXattach, Patch(KBXoffline, Defaults(KBXoffline), {Attachments: Attachments....})?

    I have attachments field in my sharepoint list
    Thanks in advance

     

     

     

  • Matt383 Profile Picture
    Matt383 395 on at
    Re: Saving attachments from entry to collection list

    Thanks Phoebe, i will give it a go this afternoon, much appreciated.

     

  • Re: Saving attachments from entry to collection list

    Hi @Matt383 ,

    Do you want to use collection to update attachments?

    I'm afraid it's not supported in powerapps now.

    To update attachments, you should :
    1)use attachments control

    2)attachments control could only be used in a form

    3)use SubmitForm function to update

    So using Collect() function or Patch() function will not work neither.

     

    I suggest you firstly save attachments in one collection, then load this collection to attachments control inside a form, then use suabmitform function to submit this form.

    I've made a similar test for your reference:
    1)form1 to upload attachments

    DataCardValue30 is the attachments control name in form1

    set the button's OnSelect:

    ClearCollect(KBZcollection,DataCardValue30.Attachments);
    //save attachments in a collection
    SaveData( KBZcollection, "LocalSavedItems" )
    //save this collection to local 

    2)form2 to load this attachments

    set this screen's OnVisible:

    LoadData( KBZcollection, "LocalSavedItems" )

    set attachments control's Items (inside form2):

    KBZcollection

    use a button to submit form2, set the button's OnSelect:

    SubmitForm(Form2)

     

    When you are offline, you use form1 to upload attachments.

    When you are online, you load attachments to form2 then submit to sharepoint list.

    922.gif

     

     

    Best regards,

  • WarrenBelz Profile Picture
    WarrenBelz 145,445 on at
    Re: Saving attachments from entry to collection list

    Hi @Matt383 ,

    You can only achieve this with a Flow - this blog of mine has the process for saving an image as an attachment - yours will be similar in concept, but sending the file content rather than the image.

    Happy to assist once you have put some structure around the code with your field and control names.

     

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard