How to auto separate MS Lists uploads into separate Sharepoint folders using Power Automate?

Anonymous
2024-04-09T20:38:05+00:00

Hello,

Just realized that MS Lists only allows 1 column for attachments (though allowing multiple attachments). The problem is, I was trying to create multiple columns so the attachments can be added by category.

Since I can't categorize multiple columns, I need to be able to separate the attachments into categorized folders once they are uploaded but I want to do this automatically.

How do I use Power Automate to grab the attachments and place each file in separate SharePoint folders? Thanks!

Lissa

Microsoft 365 and Office | Install, redeem, activate | For business | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

54 answers

Sort by: Oldest
  1. Anonymous
    2024-04-24T07:06:34+00:00

    Dear Lissa,

    The array part is created in the red box part like the following.

    {

    "Name": "@{items('Apply_to_each')['name']}",

    "Content": @{body('Get_file_content')}

    }

    If you add a send Apply_to_each such as Apply_to_each_2 in my flow screenshots, the answer is Yes. You can paste items('Apply_to_each_2')?['Name'] in the File Name field and paste items('Apply_to_each_2')?['Content'] in the File Content field.

    Welcome to share any updates at your convenience if you need further help on this issue.

    Thank you for your effort and time.

    Sincerely

    Cliff | Microsoft Community Moderator

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2024-04-26T17:50:42+00:00

    Thank you for your wonderful explanation! I am very appreciative. I understand now that with your response, I only needed to copy and paste the code.

    The example I gave was to help explain what I needed to accomplish but I need to accomplish this for multiple folders. In other words, I need the attachments from MS Lists to be automatically added to multiple folders based on the file name.

    For example: Jane completed the MS Form and uploaded 3 files: Category_Blue_Jane, Category_Green_Jane, and Category_Red_Jane. Each file needs to be added to the corresponding folder according to the category contained in the file name.

    📁Category Blue

    1. Category_Blue_Jane ⬅️
    2. Category_Blue_Jon
    3. Category_Blue_Jen

    📁Category Green

    1. Category_Green_Jane⬅️
    2. Category_Green_Jon
    3. Category_Green_Jen

    📁Category Red

    1. Category_Red_Jane ⬅️
    2. Category_Red_Jon
    3. Category_Red_Jen

    How can the instructions you've provided be updated to accomplish this?

    Thanks!

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2024-04-27T04:37:27+00:00

    Dear Lissa,

    You may add 3 more filter arrays and 3 more create file based on the original flow like the following.

    Filter Array: filter all files whose names contain Category Red, Category Green and Category Blue.

    Use the formula: @or(contains(replace(item()?['Name'], '_', ' '), 'Category Blue'), contains(replace(item()?['Name'], '_', ' '), 'Category Red'), contains(replace(item()?['Name'], '_', ' '), 'Category Green'))

    Filter Array 2: Filter the files whose names contain Category Red from Filter Array.

    replace(item()?['Name'],'_',' ') contains Category Red

    Create the files in Category Red:

    items('Apply_to_each_2')?['Name']

    items('Apply_to_each_2')?['Content']

    Filter Array 3: Filter the files whose names contain Category Blue from Filter Array.

    replace(item()?['Name'],'_',' ') contains Category Blue

    Create the files in Category Blue:

    items('Apply_to_each_3')?['Name']

    items('Apply_to_each_3')?['Content']

    Filter Array 4: Filter the files whose names contain Category Green from Filter Array.

    replace(item()?['Name'],'_',' ') contains Category Green

    Create the files in Category Blue:

    items('Apply_to_each_4')?['Name']

    items('Apply_to_each_4')?['Content']

    Welcome to share any updates at your convenience.

    Thank you for your effort and time.

    Sincerely

    Cliff | Microsoft Community Moderator

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2024-04-29T16:52:31+00:00

    Sigh...

    Thanks again for your assistance but I'm not viewing the results you are showing in your screenshots.

    1. The OneDrive site is not listed in the Site Address dropdown menu. I've copied and pasted it in, but I'm unsure if that is the correct way to add the Site Address.
    2. When I paste the File Name and File Content codes you provided, the code does not revert to the colored view as shown in your screenshot and as seen before when pasting previous codes. I don't know why that is or if that's a sign of an issue.

    1. When I add the additional Filter Arrays, the options displayed in your screenshot is not what is available to me. I don't have the field to paste the code: @or(contains(replace(item()?['Name'], '_', ' '), 'Category Blue'), contains(replace(item()?['Name'], '_', ' '), 'Category Red'), contains(replace(item()?['Name'], '_', ' '), 'Category Green')). I'm only given the options as seen below.

    Please advise, thanks.

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2024-04-30T05:21:35+00:00

    Dear Lissa,

    Thanks for your updates and kindness.

    Here are the answers of the question.

    1. If you use the OneDrive for Business site address, you can select Enter custom value and type the OneDrive for business site URL such as https://contoso-my.sharepoint.com/personal/username\_contoso\_onmicrosoft\_com.

    1. You need to click on Expression to type the code.

    1. For Filter Array code, you need to click on Edit in advanced mode to type the code.

    Welcome to share any updates at your convenience.

    Thank you for your effort and time.

    Sincerely

    Cliff | Microsoft Community Moderator

    Was this answer helpful?

    0 comments No comments