cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
RH-MP
Level: Powered On

When a specific field in a SharePoint item list is modified/updated copy the item's attachment to a specific SharePoint library

I have a SharePoint list that contains a field named 'isCompleted' and is set to 'No' by default.

When this field is set to 'Yes' I want flow to get the item's attached files and copy it to a specific library that is also based on a field in my list.

Appreciate any help that I can get.

Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
RH-MP
Level: Powered On

Re: When a specific field in a SharePoint item list is modified/updated copy the item's attachment to a specific SharePoint library

Made it work:
MS Flow.png
Set the fileExtension variable as: 

substring(items('Apply_to_each')?['DisplayName'],variables('indexOfPeriod'),variables('newLength')), and put it at the end of the Create file - File Name. My variable names are pretty simple but I don't know if it makes sense?

View solution in original post

7 REPLIES 7
Dual Super User
Dual Super User

Re: When a specific field in a SharePoint item list is modified/updated copy the item's attachment to a specific SharePoint library

HI @RH-MP 

 

Currently a trigger based on a change of a particular field of a sharepoint list item is not supported in flow. You can submit an idea here:

https://powerusers.microsoft.com/t5/Flow-Ideas/idb-p/FlowIdeas

 

Alternatively, as a workaround, you have mentioned the field is set to No by default so you can use the trigger when an item is created or modified and after the trigger, place a condtion to check if this field is yes and then run the flow else terminate. 

 

Hope this helps!!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

RH-MP
Level: Powered On

Re: When a specific field in a SharePoint item list is modified/updated copy the item's attachment to a specific SharePoint library

Hi @yashag2255

Appreciate it.


Yes, the workaround that you stated is what my flow currently does.  Guess I have to stick with that.

Another thing, I made use of the 'Create a file' step and it's working although the file type is .file instead of the original file type I copied it from. Do you happen to know any solution for this?

Dual Super User
Dual Super User

Re: When a specific field in a SharePoint item list is modified/updated copy the item's attachment to a specific SharePoint library

HI @RH-MP 

 

Could you post a screenshot of that? We might be able to assist you better that way. In the create file action, you need to put the file extension in the filename itself. so if it is a pdf you are getting from somewhere and creating afile so the filename would be filename.pdf (Makes sense?)

Community Support Team
Community Support Team

Re: When a specific field in a SharePoint item list is modified/updated copy the item's attachment to a specific SharePoint library

Hello,

When you create the file are using some like [nameoffiledynamiccontent].[extensiondynamiccontent] or just the first part?

If it is the second that is why you are having that, you need to specify the extension dynamicaly or staticaly
RH-MP
Level: Powered On

Re: When a specific field in a SharePoint item list is modified/updated copy the item's attachment to a specific SharePoint library

Made it work:
MS Flow.png
Set the fileExtension variable as: 

substring(items('Apply_to_each')?['DisplayName'],variables('indexOfPeriod'),variables('newLength')), and put it at the end of the Create file - File Name. My variable names are pretty simple but I don't know if it makes sense?

View solution in original post

RH-MP
Level: Powered On

Re: When a specific field in a SharePoint item list is modified/updated copy the item's attachment to a specific SharePoint library

It just came to me right now, the one that I made is good for 1 is to 1 (1 attachment ot 1) but I have this attachment naming convention that is based on the item fields:
MS Flow 2.PNG

 

Whatever the filename of the attachment, once it is saved, it will create a file on the specified directory with a new file name which would be Description_Client_Module_DocType_AccountNumber. Problem is if I have multiple attachments, it will overwrite all of the other files and save the last file.

Dual Super User
Dual Super User

Re: When a specific field in a SharePoint item list is modified/updated copy the item's attachment to a specific SharePoint library

Hi @RH-MP 

 

First, you need to have the file extension (.pdf, .jpg etc) for the attachment. 

 

Second, you can add a dynamic value to the attachment so that every attachment gets a new name. (You can use the utcnow() as a part of the naming convention and this will add the date time stamp of when the attachmemt was added)

 

Hope this Helps!

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (3,987)