cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Download all attachments with one button

I have a SharePoint list where I can have some attachments on each row.
I'm trying to make a button that downloads all attachments from a set of filtered rows.

 

ForAll( RenameColumns( Filter(Document; Project.Value = 888885); "ID"; "IDdocs") ;
    Collect(colTrying1; {Value: IDdocs});;
    ForAll(  LookUp(Document; IdDocument = Last(colTrying1).Value ).attachments;
        Download(AbsoluteUri);;
        Collect(colTrying2; AbsoluteUri);;
    )
)

 

In this code no downloads are made (and there are files) and the colTrying2 collection always remains empty.

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Anonymous ,

I will give you a process I use and see if it suits your needs. A number of my apps have a simple process of taking a photo and then using the attachment control to attach it to the SharePoint list item. All attachment images are then displayed as thumbnails in a gallery for the user to review (rather than open each one).

The process is fairly simple - firstly I will call the Attachment Control AttachPhotos and the Collection colPhotos. I have a button to refresh/initiate the view, but this could be done in other ways. So on the OnSelect of the button

ClearCollect(
    colPhotos,
    AttachPhotos.Attachments
)

this puts all the attachment details, including content into the collection colPhotos.
Now in my gallery, which has an image control, the Items are colPhotos and the Image Control Image property is

 ThisItem.Value

You can also display other metadata such as the date and time the picture was taken and the file name. Does this address what you are trying to do?

 

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.

View solution in original post

3 REPLIES 3
WarrenBelz
Super User
Super User

Hi @Anonymous ,

I will give you a process I use and see if it suits your needs. A number of my apps have a simple process of taking a photo and then using the attachment control to attach it to the SharePoint list item. All attachment images are then displayed as thumbnails in a gallery for the user to review (rather than open each one).

The process is fairly simple - firstly I will call the Attachment Control AttachPhotos and the Collection colPhotos. I have a button to refresh/initiate the view, but this could be done in other ways. So on the OnSelect of the button

ClearCollect(
    colPhotos,
    AttachPhotos.Attachments
)

this puts all the attachment details, including content into the collection colPhotos.
Now in my gallery, which has an image control, the Items are colPhotos and the Image Control Image property is

 ThisItem.Value

You can also display other metadata such as the date and time the picture was taken and the file name. Does this address what you are trying to do?

 

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.

Anonymous
Not applicable

Thank you @WarrenBelz !That is... I created a hidden gallery. And I added in this gallery only 1 attachment control called attFiles.
Then in my download OnSelect button I did:

ForAll( 
   Filter(glrAttachmetns.AllItems;'has attach'); 
   Collect(colAnexos; attFiles.Attachments )
);;
ForAll( 
   RenameColumns( colAnexos;"Value";"MyLink") ; 
   Download("https://domain.sharepoint.com/sites/MySite" & Substitute( 
      MyLink;"%252f"; "/"))
)

PowerApps needs better attachment control. It would be perfect if you had the possibility to zip it and then save the attachment ... But ok!

Anonymous
Not applicable

So in the download function, the address has to be the sharepoint URL and Substituting the value of attachments right ?

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,518)