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: Most helpful
  1. Anonymous
    2024-06-01T05:42:39+00:00

    Dear Lissa,

    Thanks for your updates.

    Based on your previous description, you use Microsoft Forms to upload the attachments and category the attachments to the corresponding folders in the library in OneDrive for Business and SharePoint Online, so you don't need to involve the Microsoft List related connectors unless that you want to do something in Microsoft List or the SharePoint Online list.

    The screenshots you copied from my previous replies are to get the uploaded attachments and category them to the folders in SharePoint Online.

    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
  2. Anonymous
    2024-05-31T13:16:14+00:00

    Thank you very much for that information. I will begin my attempt to implement this.

    Just one quick question. Which of the Actions below is adding data to the MS List? You provided the images below in an earlier section of this thread and I'm just reviewing.

    Thanks,

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2024-05-31T05:06:24+00:00

    Dear Lissa,

    Thanks for your your updates and kindness.

    If the name parameter is extracted correctly from Parse JSON, you don't need to change it.

    For your reference: Common ways to use a form in a flow - Power Automate | Microsoft Learn

    items('Apply_to_each') is to get the values of fields in an array. It can't be changed.

    I see that you use Apply to each 6 as the name of the Apply to each action. So you may use the formula like the following in your environment to see the result if the file name format is like upload file name+_your name+extension or upload file name+_your name+number+extension.

    substring(items('Apply_to_each_6')?['name'],0,indexOf(items('Apply_to_each_6')?['name'],'_'))

    substring(items('Apply_to_each_6')?['name'] , indexOf(items('Apply_to_each_6')?['name'],'.'), sub(length(items('Apply_to_each_6')?['name']),indexOf(items('Apply_to_each_6')?['name'],'.')))

    Regarding "I advised that there is no available preview (these are image files) for the files that are added to OneDrive via the automation. If I manually add a file to the same folder, I am able to click on it and see a preview. If the file is added via the automation, I get a no available preview message.", based on my tests, the files created in the folder in OneDrive for Business or SharePoint Online by the flow can be previewed.

    You can see the screenshots showing the result in my previous reply.

    So what is the outcome at your side? Some related screenshots are appreciated.

    Note: Remove any private information before uploading the screenshots.

    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-05-30T15:48:16+00:00

    Flow save failed with code 'InvalidTemplate' and message 'The template validation failed: 'The inputs of template action 'Compose_2' at line '1 and column '7771' is invalid. Action 'Apply_to_each' must be a parent 'foreach' scope of action 'Compose_2' to be referenced by 'repeatItems' or 'items' functions.'.'.

    Thank you very much for that information. I'll mention once more that I have never used Power Automate before and the instruction to update the formula to match my flow leaves me not knowing what to do. I don't understand the formula structure because I have not worked with them before and I don't know what in the formula should be edited to match the flow.

    I added the Apply to Each and Compose actions, pasted the formula you provided, and got a failure message (because I don't know how to change the formula). I ask that you kindly provide the specific instructions and screenshots needed to complete this correctly as advising me to change the formula based on my environment does not provide clear guidance to someone who has never used Power Automate.

    Can you please explain exactly what needs to be done? For example, if I need to change the formula, tell me what part of the formula I need to change and how to know what I need to change it to.

    Example:

    Extract the original file name:

    substring(items('Apply_to_each')?['name'],0,indexOf(items('Apply_to_each')?['name'],'_'))

    Here's how:

    Change the name to (whatever)

    Change the items to (whatever)

    Something like this would be very helpful because again, I've never used Power Automate before. The steps that are obvious to you are not obvious to me.

    Also, I advised that there is no available preview (these are image files) for the files that are added to OneDrive via the automation. If I manually add a file to the same folder, I am able to click on it and see a preview. If the file is added via the automation, I get a no available preview message. Please advise.

    Thanks so much

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2024-05-30T05:01:12+00:00

    Dear Lissa,

    Thanks for your updates.

    Yes, the file name will be changed when they are added as attachments from Microsoft Forms. The format is upload file name+_your name+extension or upload file name+_your name+number+extension.

    If you generally upload the file to a site library by yourself, the name will not be changed.

    For the requirement "the flow will be updated by removing the OneDrive for Business (Create file) and adding the SharePoint Create file option.", you actually don't need to create the file in the folders in OneDrive for Business. Just creating the corresponding folders in SharePoint Online and then using the Create file (SharePoint) action is preferred.

    Regarding "Please advise where the formula you provided should be added as I don't understand.", substring is used to extract the text in a string from a specific position, indexOf is used to get the text length before a specific keyword, sub is the minus result between two numbers and length is the total length of a string.

    For your reference: List of string operations - Power Automate | Microsoft Learn

    After you use Parse JSON to extract the file attachment parameters, you can add the Compose action with Apply_to_each to get the trimmed file name of each file like the following.

    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