Skip to main content

Notifications

Community site session details
Power Automate - Building Flows
Answered

Automatically updating a sharepoint list when uploading specific files to Document Library

Like (0) ShareShare
ReportReport
Posted on 21 Dec 2022 12:07:06 by 31

Hi,

 

So I have a teams site in which I'll have reports being uploaded daily, and with this I have a progress tracker (done as a list) for each report. I have a total of 11 files that will be uploaded every day with each having a keyword that's always included in the file name. My goal out of this flow would be as follows - 

 

1. File is uploaded to document library

2. Flow gets file name

3. Switch Control then cycles through cases to find equivalent partial file name (Because it's a keyword and the file names have dates, which change daily, I have to do a partial match to the file name)

4. When a case is picked up/recognised it then updates an item in my list (which also has a specific name) to the 'Completed' Status

 

I have attempted multiple different way of doing this, both with condition and switch controls. Preferably I'd need it to work with a switch control, I have little experience in coding myself so I've also attempted things like the array function, base64String (as per this forums suggestion https://powerusers.microsoft.com/t5/Building-Flows/How-to-specify-a-file-title-so-that-when-it-s-uploaded-the/m-p/1932883) and have been with no luck sorting this flow out.

 

  • Hedimmer Profile Picture
    31 on 03 Jan 2023 at 09:17:00
    Re: Automatically updating a sharepoint list when uploading specific files to Document Library

    This worked a charm perfectly

     

    Thank you for another great solution Grant 🙂

  • Verified answer
    grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on 26 Dec 2022 at 00:23:50
    Re: Automatically updating a sharepoint list when uploading specific files to Document Library

    @Hedimmer I've come up with a slightly different approach to get what you're after.

     

    For this example, I've got the following list including keywords to cater for the RPM Production Validity, etc.

    grantjenkins_12-1672014913013.png

     

    And a folder called Reports in my Documents library.

    grantjenkins_1-1672013090674.png

     

    The full flow is below. I'll go into each of the actions.

    grantjenkins_6-1672013502290.png

     

    When a file is created waits for a new file to be created within the Reports folder.

    grantjenkins_3-1672013199431.png

     

    Get items returns all the items in the Reports List.

    grantjenkins_7-1672013531765.png

     

    Select uses the output from Get items to build up an array of objects. If the file name contains an item, the Value will be set to true, otherwise it will be false. The expressions used are below. Note that we also convert the filename and keyword(s) to uppercase so we can effectively ignore the case.

     

    //Title
    item()?['Title']
    
    //ID
    item()?['ID']
    
    //Value
    contains(toUpper(triggerOutputs()?['body/{Name}']), toUpper(item()?['Keywords']))

     

    grantjenkins_8-1672013554010.png

     

    Filter array removes any items that don't have a Value of true, so we should be left with just a single item if there was a match. The expression used is:

     

    item()?['Value']

     

    grantjenkins_9-1672013661180.png

     

    Condition checks to see if there is a single item in the Filter array which indicates that we got a single match. The expression used is:

     

    length(body('Filter_array'))

     

    grantjenkins_0-1672018960003.png

     

    If the Condition is true, we go into the Yes branch and use Update item to update our list. The expressions for the Id and Title are:

     

    //Id
    first(body('Filter_array'))?['ID']
    
    //Title
    first(body('Filter_array'))?['Title']

     

    grantjenkins_10-1672013860022.png

     

    However (optionally), if Condition was false, we go into the No branch and Send an email informing us that a new Report was uploaded but didn't match any of the criteria.

    grantjenkins_11-1672013969588.png

     

  • Hedimmer Profile Picture
    31 on 23 Dec 2022 at 08:51:09
    Re: Automatically updating a sharepoint list when uploading specific files to Document Library

    Technically speaking it wouldn't cause a problem to do so. Because I'm trying to get it so that all I need to do is drop a file and everything else is automated however I think (in the case of being lazy when it comes to doing the reports) that changing the names would then result in a slower process than how I thought it could play out. 

     

    Also with your match the title in the list question, correct me if I'm wrong, but I'd then need to make sure the list has the exact date every time I'd want the flow to work and match. Which would mean I'm changing my list everyday to match the exact file name

     

    "you also update the Title field of the file in the library to match your Title in your list" - This sounds like a better option, I say this with little experience, if it can be automated that is

     

    I did have an idea come to me, what if I use a button flow in which it would literally just change the status to completed for a certain list item when pressed? Because I can add the buttons to my site and, it may not be automated, then I don't have potentially several flows all working to update an item :' )

  • grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on 21 Dec 2022 at 22:12:06
    Re: Automatically updating a sharepoint list when uploading specific files to Document Library

    Is there any chance you can change the file names, so they match the Title in your list? For instance, Keyword(s) - Date.

     

    Or when you upload the files, you also update the Title field of the file in the library to match your Title in your list? That way you can have a switch on the Title of the file.

  • Hedimmer Profile Picture
    31 on 21 Dec 2022 at 13:38:01
    Re: Automatically updating a sharepoint list when uploading specific files to Document Library

    And there's no way to make it otherwise? From what I understand in what I've read - Condition controls have a limit of 10 options in power automate free, and I'd rather have it all on one flow rather than creating multiple, so because I have 11 reports I can't use a condition control to do this (or more like don't want to until it's absolutely necessary). 

     

    Also I have no idea if in future there will be more reports added, in which case I would reallly prefer the switch control to make it less clunky in it's process.

  • Hedimmer Profile Picture
    31 on 21 Dec 2022 at 13:33:05
    Re: Automatically updating a sharepoint list when uploading specific files to Document Library

    Below are all the file names.

    Hedimmer_0-1671629291203.png

    And below is the reports tracker I have as a list

    Hedimmer_2-1671629561748.png

     

    So the only one that doesn't have an obvious match is the 'Unscanned from Mill' which correlates to my RBM Production Validity on my list.

  • grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on 21 Dec 2022 at 13:26:30
    Re: Automatically updating a sharepoint list when uploading specific files to Document Library

    Can you show what the 11 files would be named (with sample dates) as an example?

  • RobElliott Profile Picture
    10,134 Super User 2025 Season 1 on 21 Dec 2022 at 13:07:20
    Re: Automatically updating a sharepoint list when uploading specific files to Document Library

    @Hedimmer you can't use a switch here because Switch always looks for equals, not a partial match.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Automate - Building Flows

#1
stampcoin Profile Picture

stampcoin 101

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 82 Super User 2025 Season 1

#3
David_MA Profile Picture

David_MA 48 Super User 2025 Season 1

Overall leaderboard