Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

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

(0) ShareShare
ReportReport
Posted on by 13

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.

  • yashag2255 Profile Picture
    24,442 Super User 2024 Season 1 on at
    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!

  • RH-MP Profile Picture
    13 on at
    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.

  • Verified answer
    RH-MP Profile Picture
    13 on at
    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?
  • Mirega Profile Picture
    on at
    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
  • yashag2255 Profile Picture
    24,442 Super User 2024 Season 1 on at
    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?)

  • RH-MP Profile Picture
    13 on at
    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?

  • yashag2255 Profile Picture
    24,442 Super User 2024 Season 1 on at
    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!

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492