cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Add Form Attachments to Planner Task

Hello,

I am very new to Power Automate, but I was able to use Forms to build a flow that creates a task in Planner when a Form is submitted.  I am able to Update the Task Details with all the information I need except the files that the submitter added to the form.  Instead, those files are moved to a folder somewhere that is not easy to access.

 

How do I get the files submitted with the form added to the Planner Task?

Thanks,

Jacob

16 REPLIES 16
rsaikrishna
Dual Super User
Dual Super User

@Anonymous 

 

The attachments submitted in the form are stored in the OneDrive. 

 

To copy the attachments from the MS Form, you can refer the following blog:

https://www.bythedevs.com/post/working-with-files-on-ms-forms-in-ms-power-automate

 

If you want to attach the attachments with the Planner Task, you can refer the following blog:

https://powerusers.microsoft.com/t5/Power-Automate-Community-Blog/Create-Planner-Task-and-Include-Attachments-From-Outlook-Email/ba-p/245121

Note: The above blog save the attachments from email but you can ignore it and use the logic to create planner task and include attachments.

 

Please let me know if you have any questions.

 

Regards

Krishna Rachakonda

If my reply helps resolving the issue, please mark the reply as Accepted Solution

 

Anonymous
Not applicable

Hello Krishna, I appreciate the feedback. Unfortunately, I'm not understanding the coding well enough to decipher how to use these examples on a MS Form instead of an email.  Planner Tasks have a place to put attachments so I would really like the attachments from the Form to end up there instead of having to look them up in the OneDrive folder.  Can you help clarify the logic behind this flow so that I might be able to understand how to convert?  Thanks.

@Anonymous 

 

I will create a sample and will share it with you shortly.

 

Regards

Krishna

Was this solved? Is there an example with screenshots you can post? I'm also confused about this and am having trouble translating all this Outlook instruction to Forms attachments.

Anonymous
Not applicable

Hi tojzanc, My IT department figured it out for me.  I'll attach photos of the flow they used.

Anonymous
Not applicable

jacobs1292_0-1595433526531.png

 

dm_elementwa
Helper I
Helper I

After scraping through SO MANY FORUMS and watching a bucket load of YouTube videos I have FINALLY worked out the solution to this and its no where near as complicated as some people made it out to be.

I am a novice to intermediate Power Automate user, so I'll try to keep this simple. I hope this helps someone! Took me 3 days to figure out.

 

1. OK, so first you want to set up capturing the form responses as per usual and I also like to grab the profile of the user who submitted the request so I can use it later on in the flow. I then have it create an item in a Sharepoint List (which I made columns for all my form responses).

Screen Shot 2020-10-14 at 10.34.03 am.png

 

2. Add the "Parse JSON" step (this is where I got confused). The Content is the attachment form field and the Schema (to make life easier) you can just copy and paste the below:

 

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

 

Screen Shot 2020-10-14 at 10.46.54 am.png

 

3. Next step is to add "Get File Content Using Path". (Don't worry about adding the Apply to Each, it will automatically apply this in a moment). Type in the file path to the OneDrive location. It will be /Apps/Microsoft Forms/***Form Folder Name Here***/Question/ then add the "name" dynamic content. It will automatically switch this to an Apply To Each step and apply the Body in the output section.

In this step I have it update the attachment to the sharepoint item (not sure if this step is crucial to then adding it to Planner, but I did it anyway!)

Screen Shot 2020-10-14 at 10.50.45 am.png

 

4. Add your next step outside of the Apply To Each box which is to "Create a Task" in Planner. Then add a 1 minute delay following the creation of the task.

Screen Shot 2020-10-14 at 10.59.48 am.png

 

5. Now add an "Apply to Each" and within this step, "Update Task Details". Now the part where it adds attachments! The reference alias will be the 'name' of the file and the reference resource is the 'link'. No weird expressions, formulas or complicated code - these are dynamic content options that will appear for you in the list! 🙂 

Screen Shot 2020-10-14 at 11.02.45 am.png

 

EXAMPLE:

Screen Shot 2020-10-14 at 11.06.47 am.png

***IMPORTANT*** If you require several people within your organisation to be able to access these attachments, you have to give them permission from the OneDrive folder to be able to view or edit these links!
Open your OneDrive App in a browser and navigate to the Form folder. You'll want to grant access to the 'Question' folder for that form. Click on the more options (...) and select 'Manage access'. Then, where it says "Direct Access" click on the "+" icon and type in the group or individual email addresses of the people you would like to grant the access too. I gave them edit permissions, but I'm pretty sure view permissions work also.

Screen Shot 2020-10-14 at 11.15.47 am.png

Screen Shot 2020-10-14 at 11.16.16 am.png

 

Now you're done! 🍾🥳

Thank you for the step-by-step explanation, I just started with power automation and I think this saves me a few days of work.

By the way: I omitted the sharepoint update step and it seems to work all the same.

 

you're welcome! glad I could help someone and minimise days of searching 😉

juresti
Continued Contributor
Continued Contributor

Hi,

 

I've been trying to attach a file this way, except it links it instead.

 

What does your link look like which causes it to attach instead of link?

 

I don't see a way to attach it.

 

Capture.PNG

 

Hey @juresti ,

 

Unfortunately, that part I couldn't work out. I too wanted the attachments, not a link to the attachment, and I tried several formulas to try and detect the type of attachment, but it wouldn't work for me. I just had to stick with links.

juresti
Continued Contributor
Continued Contributor

Thanks @dm_elementwa 

 

I thought I may had missed something.

 

By the way, I have also looked at the API access for planner which would expose all available interactions with the connector.

https://docs.microsoft.com/en-us/graph/api/plannertaskdetails-update?view=graph-rest-1.0&tabs=http

 

I didn't find an attachment method there either. It must exist though, because they let you attach manually. It could be it is just not documented.

At least that is what I think.

 

cwest204
Regular Visitor

This method works great if there is an attachment.  However, it fails when there is no attachment.  Has anyone else experienced this or knows how to solve for the "null" value?  When I attempt to put a control in for attachment, or even adding a question asking if they have an attachment I get the same error.  The error reads, "Flow save failed with code 'InvalidTemplate' and message 'The template validation failed: 'The inputs of the template action 'Apply_to_each' at line '1 and column '7592' cannot reference action 'Parse_JSON' must either be in 'runAfter' path or within a scope action on the 'runAfter' path of action 'Apply_to_each' or be a Trigger.'.'.

Any ideas/help?

This was my solution to solve the problem of the flow failing when there is no attachment submitted.

 

After the steps for When a new response is submitted and Get response details, add a step to Initialize variable. Call it something like formsAttachments and set the type to Array.

 

Screen Shot 2021-08-26 at 1.19.19 PM.png

 

Add a condition step after initializing the variable to check if there's an attachment. Do this by using the formula empty() and inside the parentheses put the dynamic content for the title of your attachment question. Set this to check if empty is equal to false.

 

Screen Shot 2021-08-26 at 1.12.03 PM.png

 

Inside the If yes step, put the Parse JSON and Get file content using path steps. You'll also have to add a step to Append to array variable. The name will be the same name you used in the initialize variable step. Now for the Value field, this will change depending if you are using a Form that you created through your own account (OneDrive) or a Form you created through Teams (SharePoint).

 

If you created the Form through your own account, the files will be in OneDrive, so the Value will be:

{

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

"ContentBytes": @{base64(body('Get_file_content_using_path'))}

}

 

If you created the Form through Teams, the files will be in SharePoint, so the Value will be:

{
"alias": "@{items('Apply_to_each')['name']}",
"resourceLink": @{items('Apply_to_each')['link']}
}

 

Screen Shot 2021-08-26 at 1.21.19 PM.png

 

Then add your Create a task and Update task details steps. In the References area, click the small T in the upper right corner to Switch to input entire array, click to Add dynamic content and select your formsAttachments variable.

 

Screen Shot 2021-08-26 at 1.36.55 PM.png

 

Screen Shot 2021-08-26 at 1.37.08 PM.png

 

And done! I hope this helped 🙂

 

Screen Shot 2021-08-26 at 1.04.25 PM.png

juresti
Continued Contributor
Continued Contributor

Thank you @VeronicaDeSalvo 

 

I stopped using planner partly because I couldn't add attachments.

 

Adding the attachments is the same as adding them to an Send an Email action.

 

I can see it is hard to figure it out on planner because of the name they use - Reference Alias. . . .

 

It is also good to learn there is a difference between Teams and other account attachment formats.

@dm_elementwa Thanks a bunch ! You made my day !!!

Helpful resources

Announcements
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Users online (1,074)