cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Julien2
Level: Powered On

Create Attachments to SharePoint library

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!

3 REPLIES 3
Community Support Team
Community Support Team

Re: Create Attachments to SharePoint library

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, 

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Julien2
Level: Powered On

Re: Create Attachments to SharePoint library

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!

Julien2
Level: Powered On

Re: Create Attachments to SharePoint library

Hi @v-yutliu-msft ,

Any news ?

 

Thank you!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,125)