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 / Open SharePoint List A...
Power Apps
Unanswered

Open SharePoint List Attachment from PowerApps

(2) ShareShare
ReportReport
Posted on by 19

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

Categories:
I have the same question (0)
  • ricardosanchezm Profile Picture
    86 on at

    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,

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

    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,

  • alunhughes Profile Picture
    19 on at

    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

  • Dawidvh Profile Picture
    1,346 on at

    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 😉

  • gatafish Profile Picture
    6 on at

    What about a PDF. It keeps asking me to save it first

     

  • sahrastolz Profile Picture
    30 on at

    Has the AbsoluteUri method of launching an attachment stopped working? I had it going successfully in 2021 but now it's started throwing an error. Not sure whether something's changed on my end or Microsoft's.

  • alunhughes Profile Picture
    19 on at

    Hi @sahrastolz

    I've only implemented it once (back when I had the above issue). Following your comment yesterday I checked my app again this morning and it still works as expected (no changes to the code for 2+ years).

     

    What are the problems your having?

     

    Thanks,

    Alun

  • sahrastolz Profile Picture
    30 on at

    Hi Alun, thanks for your reply.

     

    I'm sure that I had the attachments loading from a collection, but I've also found that attachments and collections don't mix very well so I've fixed my problem by using a lookup to load the attachment directly from the datasource.

    The error was with the code as follows.

    Launch(First(LR_Review_Gallery.Selected.Attachments).AbsoluteUri)

    The error message was "The function 'First' has some invalid arguements".

    I've replaced the above with

    First(LookUp(LeaveDatabase,ID=LR_Review_Gallery.Selected.ID).Attachments).AbsoluteUri

    and it seems to be working again.

    Thanks for your speedy reply!

    Sahra

  • Blarue Profile Picture
    76 on at
    Launch(Concatenate(GalleryName.Selected.AbsoluteUri;"?web=1"))

    this method is not working for me, when I add this formula to the OnSelect Property of a button in my attachment gallery (Items are a collection of attachments form a SharePoint list item) I get the error that AbsoluteUri isn't recognized .. what am i doing wrong? 

    Blarue_0-1698439437043.png

     

  • Blarue Profile Picture
    76 on at

    Do you know how i can use the Value property from an attachment gallery to launch the selected gallery item? 

    I've tried different variations of this formula but keep getting a "about blank' page vs the actual attachment. 

     

    Launch(Concatenate(Gallery2.Selected.Value & "?web=1"))

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

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard