web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Create a task in plann...
Power Automate
Unanswered

Create a task in planner, once an email is moved to a folder in outlook

(0) ShareShare
ReportReport
Posted on by 88

I've created a flow which is triggered, once a mail is moved to a certain folder in outlook.
After that, I creates a task in MS Planner.

Lina_Ju_0-1712998974118.png

I only have the problem, that it creates one task per mail, but I need it to create as many tasks as receivers of the mail and assign it directly to the receivers one by one.

This is my expression for the compose action:

split(triggerOutputs()?['body/toRecipients'],';')

This is for the apply to each:
Lina_Ju_1-1713005743866.pngLina_Ju_2-1713005774836.png

 


Thank you in advance.


Categories:
I have the same question (0)
  • creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at

    @Lina_Ju The logic of your flow needs to be adjusted. Take a look at your Apply to Each action. You are loop through each item returned from the Filter Array action. 

    creativeopinion_0-1713027686366.png

     

    You are using the Filter Array action to filter out the buckets that match the names of the recipients of the email. 

    creativeopinion_1-1713027719163.png

    Each time your Apply to Each action loops through an item in the Filter Array action, it'll create a task.

     

    ---

    Manual Trigger

    Any time I'm building a flow that involves the When a new email arrives trigger—I like to create a manually triggered flow for testing. This speeds up the flow building process so I don't need to leave Power Automate, compose an email just to trigger the flow.

     

    You can get the Message ID from a flow run by inserting the Message ID dynamic content into a Compose action and sending yourself an email. 

    creativeopinion_1-1713041377366.png


    Alternatively, you can get the message id from a previous flow run by clicking on Click to Download in the Outputs of your flow trigger.

    creativeopinion_2-1713041423209.png

     

    Search for "id", and highlight the id between the double quote marks and copy that to your clipboard.

    creativeopinion_3-1713041488742.png

     

     

    A compose action is optional as you can insert the Message ID directly into the Message ID field of the Get Email (V2) action. However, I prefer to use a Compose action. 

    creativeopinion_0-1713041250856.png

     

    Get Array of Email Addresses

    The output of the recipient dynamic content from the Get Email action is a string of email addresses. Each email address is separated by a semi-colon. 

    creativeopinion_4-1713041555647.png

    To return the email addresses in an array (which you can then loop through) you will need to use an expression. Add a Compose action an insert an expression. Use the split() function. The split() function takes two parameters:

    split([string of text],[separator])

    creativeopinion_5-1713041621851.png

    Click on the dynamic content tab and insert the To dynamic content into the split() function. 

    creativeopinion_7-1713041680460.png

    Add a comma and a semi-colon between the single quotes.

    creativeopinion_8-1713041751006.png

     

    Run a test. Review the outputs of the Compose action. The string of email addresses should now appear as an array.

    creativeopinion_9-1713041816976.png

     

    ********************ADDED INSTRUCTIONS********************

    Loop through Each Email Address

    You need to loop through the array of email addresses from above. Add an Apply to Each action. 

     

    Insert the output from the Compose action above that contains the recipient array. This Apply to Each action will loop through each email address (from the Compose action above). The Apply to Each action requires an array of items to loop through. 

    creativeopinion_1-1713794408346.png

     

    Add a Compose action. This action is optional, however I like to use Compose actions to help troubleshoot. It can also help you to better understand your flow as you are building it. You'll use this Compose action to return the firstname.lastname from the email address.

     

    Add an expression and insert the split() function. The split() function takes two parameters:

    split([string of text to split],[separator to split at])

    creativeopinion_0-1713794399232.png

     

    Enter the item() function. This will return the current item you are looping through (aka the email address). Add a comma.

    creativeopinion_2-1713794622066.png

     

    Between single quotes, enter the @ symbol.

    creativeopinion_3-1713794663098.png

     

    Press OK and run a test. Review the outputs. The split() function will split your string of text (the email address) at the separator (the @ symbol) into an array of items.

     

    Since you want to only return the first item in the array (firstname.lastname) in your case, you'l need to adjust the expression. 

    creativeopinion_4-1713794720146.png

    Click on the expression to edit it. Wrap the entire expression in the first() function. Don't forget to press Update.

    creativeopinion_5-1713794793607.png

     

    Run another test. Review the outputs. The Compose action should now output the first part of the email address (before the @ symbol)

    creativeopinion_6-1713794835014.png

     

    To learn more about the Apply to Each action—check out this YT Tutorial: 3 Mistakes YOU 🫵 are Making with the Apply to Each Action in your Microsoft Power Automate Flow

     

    Filter Out Bucket

    Add a Filter Array action. Now you can use the Filter Array action to filter out the bucket. For more info on the Filter Array action—check out this YT Tutorial: Are you using the Microsoft Power Automate Filter Array Action wrong?

    creativeopinion_7-1713795055398.png

     

    Create Item

    The Filter Array will return an array of items — even if it's a single item. To prevent another Apply to Each action from being automatically added to your flow when you try to access the Bucket ID, you'll need an expression. Without an expression your Create Item Action will nest itself inside an Apply to Each action—which isn't want you want.

    creativeopinion_8-1713795336154.png

     

    Hover over the Id label—take note of the text between the square brackets and single quotes. This is the dynamic content key for the bucket id. Important: It is case sensitive.

    creativeopinion_9-1713795397747.png

     

    Remove the ID dynamic content from the bucket id field and pull the Create a task action outside of the Apply to Each action (that was automatically added). Delete the Apply to Each action that was automatically added.

    creativeopinion_10-1713795473586.png

     

    In the Create a Task action, insert an expression into the Bucket Id field. Start off with:

    ?[0]['id']

    The Filter Array action will only ever return a single item (single bucket for each recipient)—the zero in the expression above indicates you'd like to return the first item in the array. The text between the square bracket indicates you want to return the bucket id. 

    creativeopinion_11-1713795522705.png

    Place your cursor at the start of the expression by pressing the UP arrow key. Click on the dynamic content tab and insert the body dynamic content from the Filter Array action.

    creativeopinion_12-1713795621777.png

    creativeopinion_13-1713795630632.png

    Fill out the rest of the fields in the action. Keep in mind, if you are adding multiple email addresses to the Assigned User Ids (as you did in your original flow) you need to separate each by a semi-colon.

    creativeopinion_14-1713795767437.png

    Also, because you want to assign the task to each recipient, you cannot use the To dynamic content as this contains all recipients. You need to use the Current Item dynamic content (aka the email address).

    creativeopinion_15-1713795838531.png

    If you want to assign the sender as well (which is what it looked like you were trying to do, don't forget to add a semi-colon.

    creativeopinion_16-1713795891309.png

     

     

    Question:

    Can you clarify what you want your flow to do? Do you want to create one task and assign all users to the one task? Or do you want to create a task for each recipient (all with the same details)?

     

    ----

     

    In the meantime you might find these Planner YT Tutorials helpful: 

    ️Automate Microsoft Planner Tasks: Create Tasks from SharePoint & Excel in Minutes

     

    Do you want to quickly create tasks in Microsoft Planner from a SharePoint list or an Excel table? In this Microsoft Power Automate tutorial I’ll show you how to build a flow that will:

    ️ Create a task in Planner for each of your SharePoint list items

    ️ Create a flow that will trigger each time a new SharePoint list item is created

    ️ Create a tasks in Planner from an Excel Table

    ️ Add a description to your tasks

     

    IN THIS VIDEO:

      How to bulk create Planner tasks from a SharePoint List

      How to use the Get Items action with a filter query

      Tips on creating a fast flow while building and testing

      How to create a string of email addresses from a multi-person choice column

      How to dynamically select a bucket in the Create a Task action

      How to use the Filter Array action

      How to use the Condition action

      How to use the Create a Task action

      How to automatically create a Planner task when a new SharePoint list item is created

      How to bulk create Planner tasks from an Excel Table

      How to add a task description to a Planner Task

     

    ---

     

    How to Email Attachments 🖇 to Your Planner Tasks

    When you add attachments to a Planner task from your computer, the files are automatically saved in the Documents document library of the SharePoint site associated with the M365 Group of your plan. Instead of downloading email attachments to OneDrive or SharePoint just so you can add them to a Planner Task—automate it.

     

    In this Microsoft Power Automate Tutorial—I’m going to show you how build a flow that will take your email attachments and add them to a Planner task. All you need to do is copy a link to a task, forward the email to yourself and the attachments will be saved onto SharePoint and attached to your planner task. Stay tuned till the end of the video where I’ll show you how to use Trigger Conditions so this automation only runs when specific conditions are met!

     

    IN THIS VIDEO:

     How to get the Message ID from an Email

     How to use the Get an Email (V2) action with a Manual Trigger

     How to use the split() function to split an email subject line

     How to use the Scope action to group your actions

     How to create a folder for email attachments on SharePoint

     How to use the Get Attachment (V2) action

     How to create attachment files in SharePoint

     How to use the Append to Array variable action to collect attachments

     How to add multiple attachments to a Planner Task

     How to switch a manual trigger to an automated trigger

     How to use Trigger Conditions in a when a New Email Arrives Trigger

     How to trigger your flow when only specific emails arrive

     

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response!

    👉 Level up your Power Automate skills by checking out my tutorials on YouTube
    👉 Tips and Tricks on TikTok and Instagram
  • Lina_Ju Profile Picture
    88 on at

    Dear @creativeopinion,

    thank you for your answer. I want to create as many tasks as recipients in the email. This can vary from mail to mail. The tasks should always look the same for each person per Mail. Best case I want to automatically assign the tasks in planner to the recipients.
    Thank you!

  • creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at

    @Lina_Ju Can you provide insight to this action you had in your original flow? 

    creativeopinion_0-1713189809040.png

     

  • Lina_Ju Profile Picture
    88 on at

    @creativeopinion, sure this is the action I am using: 

    split(items('Apply_to_each'), '@')[0]
  • creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at

    @Lina_Ju Sorry can you please provide more clarity on the names of your bucket? From what I can gather, from your original flow you had the Filter Array nested inside the Apply to Each action which was intended to loop through each recipient. 

     

    It would appear as if you are trying to use the Filter Array action to filter out your buckets by recipient. However, in your original flow I believe you were looping through each Recipient's email address. I need clarity on how your Planner is set up. Do you have a bucket for each recipient? Is each bucket name the email address of each recipient?

    creativeopinion_1-1713277551026.png


    The more insights you can share—the easier it is to provide recommendations.

     

  • Lina_Ju Profile Picture
    88 on at

    Dear @creativeopinion,
    Yes, I have different buckets for each recipient, titled with "firstname.lastname" (as in the e-mail).

  • Lina_Ju Profile Picture
    88 on at

    Dear @creativeopinion
    do you have any idea on how to solve this?
    Thank you!

  • Lina_Ju Profile Picture
    88 on at

    @creativeopinion 
    for more insights, this is the error I receive:

    Lina_Ju_0-1713783229721.png

     

  • creativeopinion Profile Picture
    10,502 Super User 2025 Season 2 on at

    @Lina_Ju I've updated the original post with additional instructions based on your most recent info. Hope this helps!

  • Lina_Ju Profile Picture
    88 on at

    Dear @creativeopinion,
    thank you so much. The flow runs through smoothly, but sadly the task does not get created.

    Lina_Ju_0-1714379254447.png

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard