Skip to main content

Notifications

Power Automate - Building Flows
Suggested answer

Form attachment using Parse JSON

Like (0) ShareShare
ReportReport
Posted on 14 Jan 2025 11:10:20 by 24
Hi,
 
I''ve got a flow that's triggered by a from response. The response ID is passed to a Parse JSON action using the following to pick up a form file upload:
 
{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "name": {
                "type": "string"
            },
            "link": {
                "type": "string"
            },
            "id": {
                "type": "string"
            },
            "type": {},
            "size": {
                "type": "integer"
            },
            "referenceId": {
                "type": "string"
            },
            "driveId": {
                "type": "string"
            },
            "status": {
                "type": "integer"
            },
            "uploadSessionUrl": {}
        },
        "required": [
            "name",
            "link",
            "id",
            "type",
            "size",
            "referenceId",
            "driveId",
            "status",
            "uploadSessionUrl"
        ]
    }
}
 
 
This is then picked up using the Get file content using path action with the following path and expression
filepath/first(body('Parse_JSON'))?['name']
 
As you can see, this creats the file in the format filename_form username. 
 
My question is, how to create the correct expression in the get content using path action to return just the attachment filename, not filename_form username.
 
Hope this makes sense! 
 
Thanks for looking
  • Suggested answer
    CFernandes Profile Picture
    CFernandes 8,131 on 16 Jan 2025 at 22:26:12
    Form attachment using Parse JSON
    Can paste the URL of the Attachment in SharePoint? 
     
    The idea here would be hard code the filePath and the keep the Filename dynamic
     
    and correct the name contains Filename and username and it should be "Name"
     
    this is my URL to folder
     
    /Shared Documents/Apps/Microsoft Forms/Untitled form/Question/
     
    I then added the name dynamically screenshot below
     
    Complete Flow.
     
     
    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!
     

    Does this answer your question? Check the box :-)
     

     
     
    P.S. take a look at my blog here and like & subscribe to my YouTube Channel thanks.
     
     
  • steveg01 Profile Picture
    steveg01 24 on 15 Jan 2025 at 19:49:37
    Form attachment using Parse JSON
    Hi. @CFernandes​​​​​​​ Personal form file uploads are stored in Onedrive yes, but Group form file uploads are stored in SharePoint. As this is on a group SharePoint site, it stores them in the SharePoint doc library, which is why my get file content using path is pulling from there.
     
    I presume this is why the filename is appended with the username, but I would like to try and remove the username from the attachment filename when emailed.
  • Suggested answer
    CFernandes Profile Picture
    CFernandes 8,131 on 15 Jan 2025 at 18:08:38
    Form attachment using Parse JSON
     
    I shared a tutorial in which you can easily get the document using ID, has it not worked for you.
     
     
    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!
     

    Does this answer your question? Check the box :-)
     

     
     
    P.S. take a look at my blog here and like & subscribe to my YouTube Channel thanks.
     
  • steveg01 Profile Picture
    steveg01 24 on 15 Jan 2025 at 16:04:23
    Form attachment using Parse JSON
    Hi @Sayan
     
    This is the overall flow:
     
    I get the form response:
     
    Then get the attachment field info:
     
    Then get the file content from a SharePoint shared site where the form is hosted:
     
    Above is where the expression is 
    first(body('Parse_JSON'))?['name']
    This same expression is then used in the Send email with options to send the attachment, and the Add attachment section to add it to the SharePoint list item.
  • Sayan Profile Picture
    Sayan 668 on 15 Jan 2025 at 07:26:27
    Form attachment using Parse JSON
    Hey @steveg01 Can you please share the workflow?
  • Suggested answer
    CFernandes Profile Picture
    CFernandes 8,131 on 14 Jan 2025 at 13:17:22
    Form attachment using Parse JSON
    Hey @steveg01 Why don't you the "Get file content" and use the "id" instead.
     
    I did a video you can find details here - https://www.youtube.com/watch?v=YDWpGW1BaBU  
     
    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!
     

    Does this answer your question? Check the box :-)
     

     
     
    P.S. take a look at my blog here and like & subscribe to my YouTube Channel 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

End of Year Newsletter…

End of Year Community Newsletter…

Tuesday Tip #12 Start your Super User…

Welcome to a brand new series, Tuesday Tips…

Tuesday Tip #11 New Opportunities…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,609

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,420

Leaderboard
Loading started