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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

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:
  • YassineBk Profile Picture
    15 on at

    @Pstork1 any idea ?

  • Verified answer
    v-xiaochen-msft Profile Picture
    Microsoft Employee 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard