How to attach files to planner tasks using Power Automate?

In this Power Automate tutorial, I will show you how to attach files to planner tasks using Power Automate.

We are going to cover here:

  • How to attach a single file to a Planner task using Power Automate.
  • How to add multiple files to a Planner task using Power Automate.

Attach a file to a Planner task using Power Automate

Here we will see how to attach a single file to a Planner task using Power Automate.

For example, we will create an Automated cloud Flow that will trigger when a file is uploaded to the SharePoint library, i.e., Resume. Then we will get the file metadata and create a Shareable link. After that, we will get the file properties used to create a task in Planner.

How to add file to planner task using Microsoft Power automate

Then, we will create a task in the Planner, with the Plan name ‘Candidate Evaluation’. Then we will attach the file link to the created task using ‘Update task details’ in Power Automate.

To create a new plan in Planner, open the planner with your credential. Then click on +New plan in the left navigation. Then provide the plan name and select the existing group -> click on Create Plan. Else it will create a SharePoint site based on your plan name.

power automate attach file to planner task

Next, we will create a flow that will attach files to the planner task using Power Automate.

Step 1: Log in to Power Automate, click on +Create, then select Automated Cloud Flow.

How to add file to planner task using Power automate

Then provide the flow name, and select the ‘When a file is created in folder’ action. Then click on Create.

To attach file to planner task using MS Flow

Now you can see the ‘When a file is created in folder’ action is added to the flow page. Then provide the below information:

  • Site address: Select or provide the SharePoint site address
  • Folder Id: Select or provide the folder id.
Microsoft power automate attach file to planner task

Step 2: Next, we will get the file metadata, so click on the +New step -> select ‘Get file metadata using path’ action. Then provide the below information:

  • Site address: Select or give the SharePoint site address.
  • File path: Select the file path below.
How to attach file to planner task using Microsoft power automate

Step 3: Next, we will create a shareable link for the files, so click on the +New step -> select Create sharing link for a file or folder action. Then provide the below information:

  • Site Address: Select or provide the SharePoint site address.
  • Library Name: Select the Library name
  • Item Id: Select the Item Id from dynamic content.
  • Link Type: Choose the link type based on the requirement.
  • Link Scope: Choose the link scope based on the requirement.
How to attach file to planner task using power automate

Step 4: Next, we will get the file properties, so click on the +New step -> select ‘Get file properties’ action. Then provide the below information:

  • Site Address: Select or provide the SharePoint site address.
  • Library Name: Select the Library name
  • Id: Select the Itemid from dynamic content.
How to attach file to planner task using MS Flow

Step 5: Now we will create a task in Planner, so click on +New step -> select Create a task action. Then provide the below information:

  • Group Id: Select the Group Id of your plan.
  • Plan Id: Select the plan id
  • Title: Select the title from the dynamic content
  • Bucket Id: Select the bucket id as Todo.
  • Start Date Time: Provide the below expression, as the start date always equals today.
formatDateTime(utcNow(),'yyyy-MM-dd') 
  • ⁠Due Date Time: Provide the below expression, so the task due date time will be start date +3 days.
addDays(utcNow(),3,'yyyy-MM-dd')
  • Assigned User Ids: Provide the assigned user id.
How to attach file to planner task using Microsoft Flow

Step 6: Now, we will attach the file to the task, so click on the +New step -> select Update task details action. Then provide the below information:

  • Task Id: Select the Id from dynamic content.
  • Description: Provide the description
  • Reference Alias 1: Provide the display name using Power Automate.
  • Reference Resource: Provide the Sharing link from dynamic content.
How to attach file to planner task using Microsoft Power Automate Flow

Step 7: Now run the flow manually, so add a new file to the SharePoint library to trigger the flow.

After that, you can see your flow run successfully. The task is created, and the file is attached to it.

How to attach file to planner task using flow

This is how to add a file to a planner task in Power Automate.

Add multiple files to a Planner task using Power Automate

Here we will see how to add multiple files to a Planner task using Power Automate.

For example, we have a SharePoint library, ‘Wells Fargo Project,’ and in this library, we have a folder called ‘Developer’. In this folder, we add task details and assigned the task to someone.

How to attach multiple file to planner task using Microsoft Power automate flow

So, we will create a flow in Power Automate that will manually trigger, get all the files from that particular folder, and check the create date, if the date is today then it will create a task (Plan name is Wells Fargo Project task) in the planner and attach the file to it.

Using Microsoft Power automate attach multiple file to planner task

Before creating the flow, set up the folder in SharePoint and create a Plan in Planner.

Step 1: Log in to Power Automate and click +Create -> select the Instant Cloud flow.

To attach files to planner task using Microsoft Flow

Then provide the flow name and select Manually trigger a flow action. Then click on Create.

To attach multiple files to planner task using MS Flow

Now you can see Manually trigger flow is added to the flow page.

Power automate attach multiple file to planner task

Step 2: Next, select the Initialize variable action, then provide the below information:

  • Name: Provide the variable name.
  • Type: Select the type as an array.
Power automate add multiple file to planner task

Step 3: Now we will get all the files from the folder, so, click on the +New step -> click on ‘Get files (Properties only)’ action.

Then provide the below information:

  • Site address: Select or Provide SharePoint site address
  • Library name: Select the library name from the dynamic content
  • Limit Entries to Folder: Select the Folder
  • Include Nested Items: Select Yes from dropdown.
Using Power automate add multiple file to planner task

Step 4: Now, we will check whether or not files in folders are created today. So, for this, click on the Condition action. Then provide the below information:

  • Choose a value: Provide the below expression. This will add Apply to each action.
formatDateTime(items('Apply_to_each_2')?['Created'], 'yyyy-MM-dd')
  • Operator: Select the operator as is equal to.
  • Choose a value: Provide the below expression:
formatDateTime(utcNow(),'yyyy-MM-dd')

If the condition is true, then in if yes part, we will create a Sharing link for a file, so click on the Add an action. Select the ‘Create a Sharing link for a file or folder’ action. Then provide the below information:

  • Site Address: Select or provide the SharePoint site address.
  • Library Name: Select the Library name
  • Item Id: Select the Id from dynamic content.
  • Link Type: Choose the link type based on the requirement.
  • Link Scope: Choose the link scope based on the requirement.

After that, click on Add an action -> select Append to array variable action. Then provide the below information:

  • Name: Select the name from the drop-down.
  • Value: Provide the below expression:
{
  "alias":@{items('Apply_to_each_2')?['{Name}']} ,
  "resourceLink": @{outputs('Create_sharing_link_for_a_file_or_folder')?['body/link/webUrl']}
}
Using Microsoft Power automate add multiple file to planner task

Step 5: Next, we will create a task in Planner, so, click on the +New step, and select the Create a task action. Then provide the below information:

  • Group Id: Select the Group Id of your plan.
  • Plan Id: Select the plan id
  • Title: Provide the title
  • Bucket Id: Select the bucket id as To do.
  • Start Date Time: Provide the below expression, as the start date is always equal to today.
formatDateTime(utcNow(),'yyyy-MM-dd') 
  • ⁠Due Date Time: Provide the below expression, so the task due date time will be start date +7 days.
addDays(utcNow(),7,'yyyy-MM-dd')
  • Assigned User Ids: Select Assigned to Email from dynamic content. This will add Apply to each action automatically.
Using Power automate attach multiple file to planner task

Step 6: Next, we will add attachments to the tasks, so click on the +New step -> select ‘Update task details’ action. Then provide the below information:

  • Task Id: Select the Id from dynamic content.
  • Description: Select the Description from the dynamic content.
  • Reference: Click on the T icon to ‘Switch to input entire array’ and provide the Files -variable from dynamic content.
How to attach multiple file to planner task using Microsoft Power automate

Step 7: Now run the flow manually, and you can see the flow run successfully, and the task gets created with multiple files.

How to attach multiple file to planner task using Power automate

This is how to attach multiple files to planner tasks using Power Automate.

Conclusion

In this Power Automate tutorial, we saw how to attach a file to a Planner task using Power Automate. Also, we learned how to attach multiple files to a Planner task using Microsoft Power Automate.

You may also like:

>