cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ChadVKealey
Impactful Individual
Impactful Individual

Working with files from the Forms "File Upload" question type

I was very excited to learn that the "File Upload" question was coming to MS Forms. We have a LOT of scenarios where we want to collect files from people in a way that also collects some metadata, so this will be very useful. However, I'm having a bit of trouble accessing those files from Power Automate.

 

So, I have a form that will be used to collect Syllabus files from faculty. They'll need to enter some course info which will be used as metadata on the uploaded file. The form automatically puts the file into a folder named after the form, several layers down in the Documents library (which I'm not thrilled about, but whatever). What I want to do is move that file to a separate document library with columns to accept the metadata. 

 

The Get Form Response action returns the file upload question response in a block that, I guess, needs to be parsed out? This is what it provides:

"r9e51ca9ff4b8420e9dd54ab305d36805": "[{\"name\":\"<file_name>.pdf\",\"link\":\"https://<tenant>.sharepoint.com/sites/<site_name>/Shared%20Documents/Apps/Microsoft%20Forms/<form_name>/Question/<file_name>.pdf\",\"id\":\"01H7BFDJ7AEHYC2NLCRJGK5UT5FNKG2ID4\",\"type\":null,\"size\":41382,\"referenceId\":\"01H7BFDJZUQGHQ4UHE6ZHLCOFMB5D24YRC\",\"driveId\":\"b!4cQiASLhPUq8SGSD21oPlB3OwJfDzrJMtPR2NlkFKObx4in0iZlARpy7sxn656jT\",\"status\":1,\"uploadSessionUrl\":null}]"
 
What I need is a way to reference the elements within that. Specifically, the "link", which I can then feed into the appropriate SharePoint actions to get that file and move it to/create it in the appropriate library. 
1 ACCEPTED SOLUTION

Accepted Solutions

Hi @ChadVKealey,

 

After you get the JSON, please add parse JSON action, then you will get two dynamic content you can using in the following steps - dirveId and id.

{
    "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"
        ]
    }
}

Then you can get the file content by using the Get file content action of OneDrive for Business connector, append the driveId and id into the File ID field, please notice that the dot between them:

Annotation 2019-12-18 180014.png

After all, you can create file by the file content.

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

10 REPLIES 10
manuelstgomes
Super User II
Super User II

Hi @ChadVKealey 

 

Can't you use the file that is returned from the form to upload to SharePoint?

2019-12-16 15_31_30-Create your flow _ Microsoft Power Automate.png

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

@manuelstgomes , unfortunately, that won't work. I need to figure out (or have someone show me) how to parse out what's returned as the "uploaded file data". It's not JSON, exactly...I'm not sure what it is. But, I'm sure there's a way to pull it apart to get the Path and Display Name values, which are what I need.

Hi @ChadVKealey,

 

You could find these files in the details of the responses:

Annotation 2019-12-17 154308.png

 If you want to get its properties apart from the answer, you can use the expression json():

Annotation 2019-12-17 154716.png

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

@v-litu-msft , could you share the expression in the input of the second Compose action? 

Actually, using the Parse json action, I can get the elements/details of the file, but it looks like "path" and "file identifier" are not among them, at least not in the forms needed by "Get file metadata from path" or "Get file metadata". The "Link" is there, so I suppose it would be possible to extract the path from that, I'm just not very good at writing those kinds of expressions. 

Hi @ChadVKealey,

 

After you get the JSON, please add parse JSON action, then you will get two dynamic content you can using in the following steps - dirveId and id.

{
    "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"
        ]
    }
}

Then you can get the file content by using the Get file content action of OneDrive for Business connector, append the driveId and id into the File ID field, please notice that the dot between them:

Annotation 2019-12-18 180014.png

After all, you can create file by the file content.

 

Best Regards,
Community Support Team _ Lin Tu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Thank you @v-litu-msft ! I'm actually using a Group Form, so the files are going into a SharePoint Document Library, not my OneDrive. I tried using the "Get file metadata" and "Get file content" actions from the SharePoint connector with the driveid.id as the "identifier" and it would fail to locate the file. However, using the actions of the same names from the OneDrive for Business connector, it's able to get the file and its contents. Considering the file is stored in SharePoint, not OneDrive for Business, I'm surprised that the OD4B actions worked. 

 

This is a potentially huge time-saver for a lot of our departments!

Anonymous
Not applicable

@ChadVKealey Sorry I've i've misinterpreted - did you manage to get it working with group forms? 

 

Struggling with the same issue so any help appreciated!

ChadVKealey
Impactful Individual
Impactful Individual

@Anonymous , yes, I did get it to work, using the OneDrive for Business actions in Power Automate to get the files from the Documents library in the Group's SharePoint site. See this video for the end-to-end walkthrough of a process I built for academic departments to collect syllabi from faculty: https://youtu.be/fjdhb9_m7Ho (or, jump to https://youtu.be/fjdhb9_m7Ho?t=440 to view just the part about Power Automate). 

 

I think this could be done using the "get file..." actions in the SharePoint connector, but finding the right combination of action, properties and values could take some trial and error. Considering OneDrive (for Business, anyway) is based on SharePoint, it's kind of frustrating that there are different actions and capabilities from the Power Automate perspective. Some other connectors treat them as equivalents. For example, some of the "Excel (Business)" actions have inputs for the file location and the drop-down shows "OneDrive for Business" and then all of the SharePoint sites/libraries to which the user has access. 

Anonymous
Not applicable

@ChadVKealey  thanks for the response & the link. I will try again with the Onedrive for business connection instead as I've spent too long in the trial and error stage of the sharepoint equivalent! Despite all the hope that this post gave me!

Cheers

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,211)