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

Populate field with attachment metadata and then delete attachment with Flow

I have a Power Apps form connected to a SharePoint list that's using attachments. I would like to attach a document that already grabs the Title metadata from the document's heading title. Instead of manually entering the Title in the form, I would like the Title field to be populated from the attached document's Title metadata. This is so that the SharePoint list item has the same title as the attached document.

Secondly and as asked in this thread, considering that Power Apps can't save attachments directly to a library, is it be possible to add an action to a Flow (one that copies an attachment from a list to a library) that then deletes the attachment from the list in order to avoid duplicates?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Hi @user180618 :

Do you want to save the file into the SharePoint library then delete the attachment in the record?

I've made a test for your reference:

add a "Delete attachment" action

Id:When an item is created-ID

File Identifier:Get attachments-id

11111111111111.PNG

Best Regards,

Bof

View solution in original post

9 REPLIES 9
Highlighted
Frequent Visitor

Sorry for the thread bump. I take it the above is not possible?

Highlighted
Community Support
Community Support

Hi @user180618 

Do you want to use the name of the attachment as the default value when you are creating a new record in a form?

Could you tell me whether you will only add one attachment to each record?

I assume that my understanding is correct, it will become very simple, even without using flow.

Ive made a test for your reference:

Step1:

Set the DataCardValue42s Default property to :

 

 

First(DataCardValue46.Attachments).Name
/*DataCardValue42 is the DataInput control in Title Card.
DataCardValue46 is the Attachment control in Attachments Card. */

 

 

eeee.png

 

Since the above solution does not use a flow and does not create attachments repeatedly, you dont have to worry about needing to delete attachments from the list to avoid duplication.

Best Regards,

Bof

Highlighted

Thanks for the response @v-bofeng-msft. To clarify a bit, can the Datacard get any other information from the attachment other than the filename? For example, the Title metadata in an attached .doc file.

 

The flow is a separate thing. Basically, I would like the .doc file (attached in the form) to be saved in a SharePoint library. Since this is not possible in Power Apps and the only way is to use Flow to copy it from a List to a Library, can the flow also delete it from the List after it's been copied? That way, I'll have the attached .doc in the Library and not in the List.

Highlighted

Hi @user180618 :

Do you want to save the file into the SharePoint library then delete the attachment in the record?

I've made a test for your reference:

add a "Delete attachment" action

Id:When an item is created-ID

File Identifier:Get attachments-id

11111111111111.PNG

Best Regards,

Bof

View solution in original post

Highlighted

Thanks @v-bofeng-msft. One more thing: can the same flow also copy the list item's metadata to the library and apply it to the attachment?

Highlighted

Hi @user180618

Sorry I didn't understand your question. Could you explain it in detail?

Best Regards,

Bof

Highlighted

Thanks for the reply @v-bofeng-msft. To clarify, can the Flow get the attachment and get the List's column values into the Library? So the attachment that's copied to the Library (and then deleted using your flow) also takes with it the values in Column1, Column2 etc.

 

In other words, what I'm basically trying to achieve with all of the above is: make Power Apps save to a Library. Since that's not possible, I'm trying to do this by saving to a List, and then using a Flow to move the information (including the attachment) from the List to the Library.

Highlighted

Hi @user180618 :

OK.I may understand what you mean.

I suggest you try this action: update file properties

1.png

Best Regards,

Bof

Highlighted
Frequent Visitor

Thank you @v-bofeng-msft

 

I modified my attachment flow with the update properties and it worked like Magic! 

 

Thank you.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,808)