web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Add attachments to col...
Power Apps
Unanswered

Add attachments to collection in offline mode then save it in sharepoint in online mode

(1) ShareShare
ReportReport
Posted on by 15

Hello,

i want to add attachment to the collections in offline and then save it in sharepoint when user is online 

i've tried this but didnt work

here i collected data from a form:

Collect(colitems, {itemtitle: DataCardValue3, itemdescription: DataCardValue4, itemattach: DataCardValue5});

 

then in the button that save data from collection to sharepoint when user is back to online mode :

ForAll(colitems,Patch(Séries,Defaults(Séries),
{Title: itemtitle.Text, Description: itemdescription.Text, Attachments: itemattach}));

 

for attachments i've tried also itemattach.Attachments.Value didn't work too 

Categories:
I have the same question (0)
  • YassineBk Profile Picture
    15 on at

    @Pstork1 any idea ?

  • Verified answer
    v-xiaochen-msft Profile Picture
    on at

    Hi @YassineBk ,

     

    It's impossible to use patch function to update 'Attachments' field.

    If the attachment you want to save is from another item's attachment, the best pratice is to save the item's ID to your device and when you online again,you could use flow to get the attachments' content and update it.

     

    If the attachment is from a local device, it will be tricky.

    Because when we upload attachment to attachment control, it will generate cache in app.

    vxiaochenmsft_0-1647497977076.png

    vxiaochenmsft_1-1647497998740.png

    When we close the app, the cache disappears. So the value of the set will be invalid when you open the app again.

    There is a method a bit of hack to get the real file content (base64) of the file.

    Add an image control and set its Image property to this value("appres://...")

    Then you could add a button and set its onselect property to:

    Set(var,JSON(Image.Image,JSONFormat.IncludeBinaryData))

    Now, you get the file content . Save it to your local device.

    vxiaochenmsft_2-1647498396639.png

     

    Let's go back to the beginning. We can use this formula to update/create attachments.

    vxiaochenmsft_3-1647498845278.png

     

    Best Regards,

    Wearsky

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard