cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
alunhughes
Frequent Visitor

Open SharePoint List Attachment from PowerApps

Hi,

 

I've created a PowerApps form using a SharePoint list and used the Attachment column. My form uploads the attachment to the SharePoint list with no problems (I only want to include max 1 attachment per list item).

 

I want to be able to open the attachment from an icon used within a gallery (open in browser is more than sufficient) so was thinking along the lines of the Launch() feature and construct a URL for the location of the attachment (i.e https://MY-TENANCY/sites/SITE-NAME/Lists/LIST-NAME/Attachments/{ID}/{ATTACHMENT-DISPLAY-NAME})

 

I see an attachment display name as a control but not sure how to construct the string for this command.

 

Can any one help?

 

Many thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @alunhughes ,

Do you want to open the Attachment (single one attachment) via pressing the icon in your Gallery?

 

Based on the needs that you mentioned, I think it is not necessary to construct a URL string for the location of the attachment of a SP List Item.

 

I have made a test on my side, please consider take a try with the following workaround:

6.JPG

 Add a Icon within your Gallery, set the OnSelect property to following:

Launch(First(ThisItem.Attachments).AbsoluteUri)

Note: The First(ThisItem.Attachments).AbsoluteUri formula would return the URL of the attachement file of a SP List Item.

 

In addition, if you want to force attaching only once file to each SP List Item, please consider set the Max attachments property to 1 as below:

7.JPG

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
ricardosanchezm
Advocate II
Advocate II

Hi @alunhughes ,

If you are using a gallery to open the attachment in a web browser you can do the following.

Launch(Concatenate(GalleryName.Selected.AbsoluteUri;"?web=1"))

 It will get the full path of the attachment and concatenate the string "?web=1" to open it in a new browser tab.  I have a gallery with a list of attachments with this command and works perfectly.

Regard,

v-xida-msft
Community Support
Community Support

Hi @alunhughes ,

Do you want to open the Attachment (single one attachment) via pressing the icon in your Gallery?

 

Based on the needs that you mentioned, I think it is not necessary to construct a URL string for the location of the attachment of a SP List Item.

 

I have made a test on my side, please consider take a try with the following workaround:

6.JPG

 Add a Icon within your Gallery, set the OnSelect property to following:

Launch(First(ThisItem.Attachments).AbsoluteUri)

Note: The First(ThisItem.Attachments).AbsoluteUri formula would return the URL of the attachement file of a SP List Item.

 

In addition, if you want to force attaching only once file to each SP List Item, please consider set the Max attachments property to 1 as below:

7.JPG

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thank you both for your help.

 

This is exactly what I need - a much simpler way using the AbsoluteUri (which I was unaware of). I had already set the max attachments to 1 🙂

 

Thanks

Hello everyone. In case you still have questions on the topic, we go through this in some more detail.

Display SharePoint List Attachments in PowerApps (2019)

 

The .AbsoluteUri requires the user to be logged into the SharePoint front-end (which is not always the case obviously), while .Value uses the SharePoint connector to fetch the attachment(s) so this is a better option.

 

Dawid van Heerden

Follow on Twitter: @davestechtips

Subscribe to YouTube: https://www.youtube.com/davestechtips?sub_confirmation=1

**If you found this reply helpful, please mark this as the answer to close the topic and make it easier to find for other people with similar questions. AND we get points for it 😉

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

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

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