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 III
Super User III

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

2 REPLIES 2
WarrenBelz
Super User III
Super User III

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

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!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (95,645)