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 / Saving Attachments to ...
Power Apps
Answered

Saving Attachments to Collection

(0) ShareShare
ReportReport
Posted on by 364

Morning all,

 

I'm trying to save a collection of all the attachments in my SharePoint list. I bring my whole list, with all of the details for a gallery, into a collection called faqCol. Then, once I click on an item in the gallery, it saves the selected record to a variable called suggested. This allows me to run all manner of fancy things based on the item selected.

 

However, in order to bring in the picture saved to that list item, I have to use this code:

 

 First(LookUp('FAQ Dataset', 
 suggested.ID = ID).Attachments).Value)

 

And that can take a little bit depending on the connection. So I was hoping to save the attachments to a separate collection called picCol on AppStart that contains the picture and the ID of the item, which I can then use for the lookup above without having to do another call to 'FAQ Dataset' (my SharePoint list). Can't seem to figure out how to do that though.

 

Any ideas?

Categories:
I have the same question (0)
  • Jreutbier Profile Picture
    10 on at

    Thanks for the reply @KayFax. I am not sure what image property you are referencing. I reviewed Image control in Power Apps - Power Apps | Microsoft Docs and can successfully display attachment images using (First(ThisItem.Attachments).Value) and (BrowseGallery1.Selected.Attachments) in the image property. Reducing the size of the attachments has improved the performance. I didn't know if leveraging a collection as this post mentions, may help with performance issues. Next, I will look at user experience and if I can provide them an easy route to keep images small when they are attaching. 

  • KayFax Profile Picture
    99 on at

    Hi, I am afraid I cannot help with this one - I tested the formula and it worked, but in the end, I used a different method for my case (which was to get attached images filtered by user and date range from an expenses list to PDFs with tables). So never actually applied this. But recently, Power Apps has changed the image properties also (from SPL Image column) - so maybe try that instead?

  • Jreutbier Profile Picture
    10 on at

    @v-xiaochen-msft, @KayFax, @EpicTriffid  Did you use this formula in OnStart? It looks like this property is off by default due to performance issues. I am searching for a solution to help with the loading of image attachments into a gallery. I found one formula that uses absoluteuri but that doesn't work on mobile. (First(ThisItem.Attachments).Value) and (BrowseGallery1.Selected.Attachments) load very slowly. Did you find this solution to speed up the loading of images in your app? How do you associate the image with the collection?

  • KayFax Profile Picture
    99 on at

    Hi, you are an absolute hero! I would also be very interested in learning how exactly this formula is constructed/functions. I would need to again filter that condition (to only collect attachments for dynamic period & user...). How could I achieve that?

  • EpicTriffid Profile Picture
    364 on at

    This works wonderfully! Thank you! 

     

    Could you possibly explain how it works? Thanks!

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

    Hi @EpicTriffid ,

     

    I did a test for you.

    1\ This is my list LIST78.

    v-xiaochen-msft_0-1620637919641.png

    v-xiaochen-msft_1-1620637937219.png

     

    2\ Add a button control and set its onselect property to:

    ClearCollect(Test,0);ClearCollect(Test2,Filter(Ungroup(ForAll(Sequence(CountRows(LIST78)),Collect(Test,Last(Test).Value+1);{AAA:Last(FirstN(LIST78,Last(Test).Value)).Attachments,BBB:Last(FirstN(LIST78,Value)).ID}),"AAA"),!IsBlank(Id)))

     

    3\ The result is as follows:

    v-xiaochen-msft_2-1620638207961.png

     

    In addition ,you could use this formula on OnStart property.

     

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

     

  • WarrenBelz Profile Picture
    153,472 Most Valuable Professional on at

    Hi @EpicTriffid ,

    Firstly, you cannot save attachments (the actual object) to a collection - you can refer to the attachments in the list from the collection as you have posted. Attachments are actually stored in OneDrive.

     

    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

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
Kalathiya Profile Picture

Kalathiya 400

#2
WarrenBelz Profile Picture

WarrenBelz 348 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 315 Super User 2025 Season 2

Last 30 days Overall leaderboard