web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Create Attachments to ...
Power Apps
Unanswered

Create Attachments to SharePoint library

(0) ShareShare
ReportReport
Posted on by 1,712

Hello everyone!

I will try my best to summarize what my problems are.

Problem One:
I have created a new screen to let the users add attachments when they want to create a new LineItem.
In this page i have a gallery which will show only the filename of the image added from their phones.
In the AddMediaButton1 i want to Create files in SP library, which will contain the FileName and i want to include the path of the uploaded image so when they click on the name it will redirect them to the image url located in SP library.
I have tried on AddMediaButton1 this function OnSelect but it didn't work:

Set(varSharePointFile, 'Expenses Bills Images'.CreateFile("test", AddMediaButton1.FileName, AddMediaButton1.Media));
Collect(varReceipt, {FN: AddMediaButton1.FileName, FL: "myurlsite" & varSharePointFile.Path, FID: varSharePointFile.Id})

I have used for title in the gallery OnSelect: Launch(FL) but it also didn't work because of AddMediaButton1.
Now, on “save” it should add the images to the SP library FileName, create new link, of current id of the item in the list.
So i didn't know how to continue this function to add the link of the image of the current item.

Set(SelectedReport,LookUp(Expenses,ID=SelectedReport.ID))

Problem Two:
I have another screen called EditLineItem where the user can edit the item and check for the uploaded photos added on creation.
So in this page i want to display in the gallery the related image of the related item id.
I have tried to set the Items’ property of the gallery to:

First(Filter(LineItems,ID=SelectedLineItem.ID))

But what would be all the function to display images that was saved on creation and redirect them to the image url.

 

Is it possible to solve this issue ? Can someone please explain, in details, and provide examples ?

 

Thank you!

Categories:
  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @Julien2 ,

    Q1:

    Do you want to upload local image to sharepoint Attachments?

    Firstly, you could only use Attachments control to update sharepoint Attachments.

    What's more, Attachments control could only be used inside form, so you could only use SubmitForm function to update it.

    Secondly, if you want to upload local image to sharepoint picture or hyperlink column, it's not supported.

    Picture column is read-only in PowerApps. Hyperlink column could only fill in url , not supported local images.

    To update local images to sharepoint Attachments field and launch the image, I've made a similar test for your reference:

    1)insert a form, set its data source to the list that you want to update ,choose attachments field.

    set the submit button's OnSelect:

     

    SubmitForm(Form1)

     

     11183.PNG

     Please note that if you want to create new item, you need to make the form including the required fields.

    Using attachments control, you can not get the attached file's name/id/url before you update it successfully.

    After you've patched it, you could get these information.

    For example:

    First(Form1.LastSubmit.Attachments).DisplayName

    First(Form1.LastSubmit.Attachments).Id

     

    2)After you patch the attachments successfully, you could set the launch button's OnSelect:

     

    Launch(First(LookUplistname,....).Attachments).AbsoluteUri)

     

    You could also try:

     

    Launch(First(Form1.LastSubmit.Attachments).AbsoluteUri)

     

    //using this will launch the attachments that you just updated

     

    Q2:

    Could you describe more clearly about "what would be all the function to display images that was saved on creation and redirect them to the image url."?

    Sorry, I couldn't quite understand this.

    If you could describe this with pictures, it will be better.

     

     

    Best regards, 

     

  • EBMRay Profile Picture
    1,712 on at

    Hi @v-yutliu-msft ,

    Q1:
    Great, I have followed your steps and now I am very close to solve my issue, so in this screenshot i have attached an image for an item, but it's only displaying the name of the item added so i have think about to display the images attached in a gallery so i can see the attached images of the item.

    Capture4.PNGImagePro[.PNG
    What i should add to the image gallery to achieve it ?

    I have added a button and set Onselect property to:

     

    Launch(First(Form1.LastSubmit.Attachments).AbsoluteUri)

     

    I got no errors but nothing happens when i click on the button.

    Considering Q2 never mind Q1 most probably solved the Q2 issue.

    Thank you!

  • EBMRay Profile Picture
    1,712 on at

    Hi @v-yutliu-msft ,

    Any news ?

     

    Thank you!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 352 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 323

#3
Mohsin Ali Profile Picture

Mohsin Ali 226

Last 30 days Overall leaderboard