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

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Search For Text in Out...
Power Automate
Unanswered

Search For Text in Outlook 365 Task Description

(0) ShareShare
ReportReport
Posted on by 83

I am trying to write a flow that will return Outlook 365 tasks whose Description field contains a specific text string.  So far, no luck.  The flow doesn’t fail, but it also doesn’t return the matching task (which I know exists). 

See screenshot below.  This is just a section of the flow.  It triggers when a new email is received in the Inbox, and then checks to see if the sender is a Contact in Dynamics 365.  If so, it looks for a matching task in Dynamics using the text string.  That side of the flow is working fine.  If the sender is not in D365, it looks for a matching task in Outlook 365.  The string variable “Hash” is just a concatenation of the email’s Conversation ID and sender, which was placed in the task’s body when the task was created by a separate flow (if it matters, the string is about 95-125 characters long and has no spaces). 

The “List all tasks” action returns all tasks, but the Condition “Body contains Hash” returns false for every task record.  And I know that the string exists in one of the tasks.  Any suggestions as to what I am doing wrong, and how to fix it?  Or if there is a better way to identify tasks in Outlook 365 that have a specific text string somewhere in the Description/Body field?  Thanks!

Flow monitor Outlook 20200319-1.png

Categories:
I have the same question (0)
  • abm abm Profile Picture
    32,858 Most Valuable Professional on at
    Re: Search For Text in Outlook 365 Task Description

    Hi @GurBAL 

     

    Change the condition mapping from Body to Body content

     

    image.png

  • Gurs Profile Picture
    83 on at
    Re: Search For Text in Outlook 365 Task Description

    What's up @abm!  Thanks for chiming in again.  I made that change, but the result was the same.  The flow runs successfully, but the Condition returns False for every task.  I checked the Body of the "List all tasks" step, and the Hash is in there. 

  • abm abm Profile Picture
    32,858 Most Valuable Professional on at
    Re: Search For Text in Outlook 365 Task Description

    Hi @GurBAL ,

     

    Could you please check your run history and make sure the hash content is there? Also if you could post a screenshot of the hash and body content text that will be helpful.

     

    Thanks

  • Gurs Profile Picture
    83 on at
    Re: Search For Text in Outlook 365 Task Description

    Also, I can't select "Body Content" in the "Apply to each" step, only in the "Condition" step.  

  • abm abm Profile Picture
    32,858 Most Valuable Professional on at
    Re: Search For Text in Outlook 365 Task Description

    Hi @GurBAL 

     

    Think that's correct because body has content and type. So when you select body in apply to each you can get body content and type.

     

    Thanks

  • Gurs Profile Picture
    83 on at
    Re: Search For Text in Outlook 365 Task Description

    Could you please check your run history and make sure the hash content is there? Also if you could post a screenshot of the hash and body content text that will be helpful.

    From the run history, here is the Hash:

    AAQkAGNkZGE3YmM3LTFhOGQtNGY5YS04NTY1LTMxMDE3YzY5ZjU4MgAQABszsJ39c024i9wIXhK5hxM=xxxx@xxxx.com

     

    And here is an excerpt of the "List all tasks" action, which includes the Hash text:

      {

        "@odata.id": "https://outlook.office.com/api/v2.0/Users('a2ba06e1-f27a-4a89-8e1f-366aa1de6350@3575f9a1-6876-4442-a74c-1633fc52280c')/Tasks('AAMkAGNkZGE3YmM3LTFhOGQtNGY5YS04NTY1LTMxMDE3YzY5ZjU4MgBGAAAAAAAjctzodOlzRJmL-zntuYUiBwAua3E7HLi7TKp6pLk51Y3XAAAAAAESAAAua3E7HLi7TKp6pLk51Y3XAADeUNmfAAA=')",

        "@odata.etag": "W/\"LmtxOxy4u0yqeqS5OdWN1wAA3ggKgg==\"",

        "Id": "AAMkAGNkZGE3YmM3LTFhOGQtNGY5YS04NTY1LTMxMDE3YzY5ZjU4MgBGAAAAAAAjctzodOlzRJmL-zntuYUiBwAua3E7HLi7TKp6pLk51Y3XAAAAAAESAAAua3E7HLi7TKp6pLk51Y3XAADeUNmfAAA=",

        "CreatedDateTime": "2020-03-19T20:26:27.0867035Z",

        "LastModifiedDateTime": "2020-03-19T20:26:27.5267652Z",

        "ChangeKey": "LmtxOxy4u0yqeqS5OdWN1wAA3ggKgg==",

        "Categories": [],

        "AssignedTo": "",

        "HasAttachments": false,

        "Importance": "Normal",

        "IsReminderOn": true,

        "Owner": "JoeUser",

        "ParentFolderId": "AQMkAGNkZABhN2JjNy0xYThkLTRmOWEtODU2NS0zMTAxN2M2OWY1ODIALgAAAyNy3Oh06XNEmYv-Oe25hSIBAC5rcTscuLtMqnqkuTnVjdcAAAIBEgAAAA==",

        "Sensitivity": "Normal",

        "Status": "NotStarted",

        "Subject": "Email follow-up: xxxx@xxxx.com (Testing task: BAL to VICR and HoG 3:24ct)",

        "Body": {

          "ContentType": "HTML",

          "Content": "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta content=\"text/html; charset=us-ascii\">\r\n</head>\r\n<body>\r\n<p>This is an automated task created by Flow. &nbsp;If a response is received to your email before you have marked this task complete, this task will be marked complete and notated. &nbsp;<br>\r\n<br>\r\nRecipient: xxxx@xxxx.com<br>\r\nSubject: Testing task: BAL to VICR and HoG 3:24ct<br>\r\nEmail Sent: 2020-03-19T20:25:00&#43;00:00<br>\r\nAll Recipients: xxxx@xxxx.com;zzzz@zzzz.com<br>\r\nConversation ID: AAQkAGNkZGE3YmM3LTFhOGQtNGY5YS04NTY1LTMxMDE3YzY5ZjU4MgAQABszsJ39c024i9wIXhK5hxM=<br>\r\nHash (ID&#43;Recipient): AAQkAGNkZGE3YmM3LTFhOGQtNGY5YS04NTY1LTMxMDE3YzY5ZjU4MgAQABszsJ39c024i9wIXhK5hxM=xxxx@xxxx.com</p>\r\n</body>\r\n</html>\r\n"

        },

        "CompletedDateTime": null,

        "DueDateTime": {

          "DateTime": "2020-03-22T00:00:00Z",

          "TimeZone": "UTC"

        },

        "Recurrence": null,

        "ReminderDateTime": {

          "DateTime": "2020-03-22T20:25:00Z",

          "TimeZone": "UTC"

        },

        "StartDateTime": {

          "DateTime": "2020-03-19T00:00:00Z",

          "TimeZone": "UTC"

        }

      },

  • abm abm Profile Picture
    32,858 Most Valuable Professional on at
    Re: Search For Text in Outlook 365 Task Description

    Hi @GurBAL 

     

    Thank you for the run history. 

     

    Could you cleanup the Body Content using HTML to Text Power Automate action step and compare?

     

    image.png

    Thanks

  • Gurs Profile Picture
    83 on at
    Re: Search For Text in Outlook 365 Task Description

    I inserted the HTML to Text action after the List all tasks, but it did not change the outcome.  The second task still contains the Hash, but the condition "Does body contain hash" still returns false for all tasks. 

    Below is the updated flow.  The reference in "Clean Tasks" is to body('List_All_Tasks').  The reference in "HTML to text" and "Does Body Contain Hash" is to items('Clean_Tasks').  

    Flow monitor Outlook 20200322-1.png

  • Verified answer
    abm abm Profile Picture
    32,858 Most Valuable Professional on at
    Re: Search For Text in Outlook 365 Task Description

    Hi @GurBAL 

     

    Thanks for the screen share. Following are the steps we did to achieve your solution.

     

    1. Use Parse JSON object to extract the schema details.

    2. Change the hashtag and content text to lowercase for comparison. 

     

    If you have anymore questions please let me know.

     

    Thanks

     

  • Verified answer
    v-litu-msft Profile Picture
    on at
    Re: Search For Text in Outlook 365 Task Description

    Hi @GurBAL,

     

    Are you case-sensitive of the hashtag? There is my test instance, "This is a test hashtag":Annotation 2020-03-23 154326.png

     

    If I set the Hash variable to "hash", the condition could find the task, and it works perfectly. But if the is A capital "Hash", it won't work:

    Annotation 2020-03-23 154327.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.

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 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard