How to save links to MS Form attachments to SharePoint List using power Automate

Lee 0 Reputation points
2025-06-07T04:59:57.05+00:00

I created a power automate flow to save attachments submitted by each Form response to SharePoint List. No issues to save multiple attachments within a single Form response. However, I also want to save all the file links to those attachments from a single Form response to a List item and all the file links should be clickable. By initializing a string variable and appending it with each file link via apply to each attachment, I can get a text string with the combined multiple URLs but the are not clickable. The list column is in multiple line text format with rich text enabled. Can anyone help?

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Galih Ridho Utomo 90 Reputation points
    2025-06-07T05:53:15.7066667+00:00
    1. Prerequisites
    2. A Microsoft Form that accepts file attachments.

    A SharePoint List with a column of type Multiple lines of text configured for Enhanced rich text (allows hyperlinks).

    Access to Power Automate with permissions for the Forms and SharePoint connectors.


    1. Flow Overview

    Trigger: When a new Form response is submitted

    Action: Get response details

    Action: List attachments for that response

    Action: For each attachment

    Upload the file to a SharePoint Document Library

      Append an HTML `<a>` link (with `<br>` after it) to a string variable
      
      **Action**: Create or update the SharePoint List item, writing the accumulated HTML into the rich-text column
      
    

    1. Step-by-Step Instructions

    A. Trigger and Get Response Data

    Trigger:

    Connector: Microsoft FormsWhen a new response is submitted

      Select your Form.
      
      **Get response details**:
      
         Connector: **Microsoft Forms** → **Get response details**
         
            Form ID: same as trigger
            
               Response ID: `Response Id` from the trigger
               
    

    B. List Attachments and Upload Files

    List attachments:

    Connector: Microsoft FormsList attachments

      Form ID: same as above
      
         Response ID: from “Get response details”
         
         **Initialize variable**:
         
            Name: `varLinks`
            
               Type: **String**
               
                  Value: leave blank
                  
                  **Apply to each** (for each attachment returned):
                  
                     **Create file** (SharePoint):
                     
                           Site Address & Library: your document library
                           
                                 File Name: `Name` (from the attachment)
                                 
                                       File Content: `ContentBytes`
                                       
                                          **Append to string variable** (`varLinks`):
                                          
                                                Value (use an expression, switching to the Expression tab):
                                                
                                                ```sql
                                                <a href='@{body('Create_file')?['{Link}']}' target='_blank'>
    

    @{items('Apply_to_each')?['Name']} </a><br> ```

                                                      This builds an HTML anchor tag pointing to the newly created file’s link and adds a line break.
                                                      
    

    C. Create or Update the SharePoint List Item

    Create item or Update item in your SharePoint List:

    Fill in any metadata fields (e.g., Title, responder’s name).

      For your **Enhanced rich text** column, set its value to the variable `varLinks`.
      
    

    Key configuration: Your List column must be set to Enhanced rich text (Rich text with pictures, tables, and hyperlinks) in List Settings. Only then will the <a> tags render as clickable links.


    1. Example Flow Outline

    When a new response is submitted

    Form ID: “Your Form”

    Get response details

      Form ID: “Your Form”
      
         Response ID: `@{triggerBody()?['responseId']}`
         
         **List attachments**
         
            Form ID: “Your Form”
            
               Response ID: `@{outputs('Get_response_details')?['body/responseId']}`
               
               **Initialize variable**
               
                  Name: `varLinks`
                  
                     Type: String
                     
                        Value: `''`
                        
                        **Apply to each** `value` (attachments)
                        
                           **Create file** (SharePoint Document Library)
                           
                                 File Name: `@{items('Apply_to_each')?['Name']}`
                                 
                                       File Content: `@{items('Apply_to_each')?['ContentBytes']}`
                                       
                                          **Append to string variable** (`varLinks`)
                                          
                                          ```sql
                                          <a href='@{body('Create_file')?['{Link}']}' target='_blank'>
    

    @{items('Apply_to_each')?['Name']} </a><br> ```

                                          **Create item** (SharePoint List)
                                          
                                             Title: responder’s name or other identifier
                                             
                                                Enhanced Rich Text column: `@{variables('varLinks')}`
                                                
    

    1. Testing and Verification

    Submit the form with multiple files.

    Check the SharePoint Document Library to confirm file uploads.

    Open the newly created List item:

    The enhanced rich-text column should display each file name as a clickable hyperlink (one per line).


    1. Additional Tips

    To customize link text (e.g., remove file extensions), use Power Automate expressions such as substring() or split().

    If you want links to open directly in the browser view, append ?web=1 to the URL.

    Ensure the List and Library permissions allow users to click through and view the files.

    With this approach, all attachment URLs from a single Form response are concatenated into one rich-text field in your SharePoint List, and each link is fully clickable. Hope that helps!Here’s a detailed, systematic, and “scientific” walkthrough in English for saving Microsoft Forms attachment links into a SharePoint List column (enhanced rich text) so they appear as clickable hyperlinks:


    1. Prerequisites

    A Microsoft Form that accepts file attachments.

    A SharePoint List with a column of type Multiple lines of text configured for Enhanced rich text (allows hyperlinks).

    Access to Power Automate with permissions for the Forms and SharePoint connectors.


    1. Flow Overview

    Trigger: When a new Form response is submitted

    Action: Get response details

    Action: List attachments for that response

    Action: For each attachment

    Upload the file to a SharePoint Document Library

      Append an HTML `<a>` link (with `<br>` after it) to a string variable
      
      **Action**: Create or update the SharePoint List item, writing the accumulated HTML into the rich-text column
      
    

    1. Step-by-Step Instructions

    A. Trigger and Get Response Data

    Trigger:

    Connector: Microsoft FormsWhen a new response is submitted

      Select your Form.
      
      **Get response details**:
      
         Connector: **Microsoft Forms** → **Get response details**
         
            Form ID: same as trigger
            
               Response ID: `Response Id` from the trigger
               
    

    B. List Attachments and Upload Files

    List attachments:

    Connector: Microsoft FormsList attachments

      Form ID: same as above
      
         Response ID: from “Get response details”
         
         **Initialize variable**:
         
            Name: `varLinks`
            
               Type: **String**
               
                  Value: leave blank
                  
                  **Apply to each** (for each attachment returned):
                  
                     **Create file** (SharePoint):
                     
                           Site Address & Library: your document library
                           
                                 File Name: `Name` (from the attachment)
                                 
                                       File Content: `ContentBytes`
                                       
                                          **Append to string variable** (`varLinks`):
                                          
                                                Value (use an expression, switching to the Expression tab):
                                                
                                                ```sql
                                                <a href='@{body('Create_file')?['{Link}']}' target='_blank'>
    

    @{items('Apply_to_each')?['Name']} </a><br> ```

                                                      This builds an HTML anchor tag pointing to the newly created file’s link and adds a line break.
                                                      
    

    C. Create or Update the SharePoint List Item

    Create item or Update item in your SharePoint List:

    Fill in any metadata fields (e.g., Title, responder’s name).

      For your **Enhanced rich text** column, set its value to the variable `varLinks`.
      
    

    Key configuration: Your List column must be set to Enhanced rich text (Rich text with pictures, tables, and hyperlinks) in List Settings. Only then will the <a> tags render as clickable links.


    1. Example Flow Outline

    When a new response is submitted

    Form ID: “Your Form”

    Get response details

      Form ID: “Your Form”
      
         Response ID: `@{triggerBody()?['responseId']}`
         
         **List attachments**
         
            Form ID: “Your Form”
            
               Response ID: `@{outputs('Get_response_details')?['body/responseId']}`
               
               **Initialize variable**
               
                  Name: `varLinks`
                  
                     Type: String
                     
                        Value: `''`
                        
                        **Apply to each** `value` (attachments)
                        
                           **Create file** (SharePoint Document Library)
                           
                                 File Name: `@{items('Apply_to_each')?['Name']}`
                                 
                                       File Content: `@{items('Apply_to_each')?['ContentBytes']}`
                                       
                                          **Append to string variable** (`varLinks`)
                                          
                                          ```sql
                                          <a href='@{body('Create_file')?['{Link}']}' target='_blank'>
    

    @{items('Apply_to_each')?['Name']} </a><br> ```

                                          **Create item** (SharePoint List)
                                          
                                             Title: responder’s name or other identifier
                                             
                                                Enhanced Rich Text column: `@{variables('varLinks')}`
                                                
    

    1. Testing and Verification

    Submit the form with multiple files.

    Check the SharePoint Document Library to confirm file uploads.

    Open the newly created List item:

    The enhanced rich-text column should display each file name as a clickable hyperlink (one per line).


    1. Additional Tips
    • To customize link text (e.g., remove file extensions), use Power Automate expressions such as substring() or split().
    • If you want links to open directly in the browser view, append ?web=1 to the URL.
    • Ensure the List and Library permissions allow users to click through and view the files.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.