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 Automate
Unanswered

Teams Chat to OneNote

(0) ShareShare
ReportReport
Posted on by

I have created a Flow using the default template "Save a message to OneNote" and that works perfectly.  The issue I am having is that I would like to modify the content that is dumped into OneNote.

 

Specifically, I would like the automation to post the Date/Time stamp of the Teams Message being "saved" into the OneNote note body.  I cannot see a way to do this with the Dynamic Content, maybe there is a way to do this with expressions?  Right now, my "hack" is to manually add this into the"myNote" popup when triggering the automation.

 

Here is the Flow's OneNote "Create a page in a section" code config:

{
    "inputs": {
        "host": {
            "connectionName""shared_onenote",
            "operationId""CreatePageInSection",
            "apiId""/providers/Microsoft.PowerApps/apis/shared_onenote"
        },
        "parameters": {
            "notebookKey":REDACTED,
            "sectionId": REDACTED,
            "pageContent""<html><head><title>Message from @{triggerBody()?['teamsFlowRunContext']?['messagePayload']?['from']?['user']?['displayName']}</title></head><body><p>Message from @{triggerBody()?['teamsFlowRunContext']?['messagePayload']?['from']?['user']?['displayName']} saved from Teams<br><br>Message details: <br>MessageID=@{triggerBody()?['teamsFlowRunContext']?['messagePayload']?['id']}<br>@{triggerBody()?['teamsFlowRunContext']?['messagePayload']?['body']?['content']}<br><br><br>Notes:<br>@{triggerBody()?['cardOutputs']?['myNote']}<br><br><a href=\"@{triggerBody()?['teamsFlowRunContext']?['messagePayload']?['linkToMessage']}\">Link to message</a></p></body></html>"
        },
        "authentication": {
            "type""Raw",
            "value""@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"
        }
    },
    "metadata": {
        "operationMetadataId""983f0072-de7f-4a40-885a-65155b67042f"
    }
}
Categories:
I have the same question (0)
  • Verified answer
    v-liwei-msft Profile Picture
    on at

    Hi @Anonymous ,

     

    As you can see, the time the message is inserted into OneNote does not exist in the dynamic content. 
    But this time can be obtained:
    vliweimsft_0-1658822686472.png

     

    You can enter this formula in Expression to get the time: 
    triggerOutputs()['headers']['x-ms-user-timestamp']
    vliweimsft_1-1658822735031.jpeg

     

     

    Best Regards,

    Levi

     

  • Community Power Platform Member Profile Picture
    on at

    Levi,

     

    Thanks for the assistance! There does seem to be an issue still even after adding in this expression.

     

    It appears that the date/timestamp that is added is the current date/time when I click "more options > Send a copy of this to OneNote"

    For example just 10 min ago I ran it on this chat:
    blurneeded.png

     

    Notice it was Yesterday (7/27) at 7:08pm (eastern time), however the output to my onenote shows the current date and time:

    onenote.png

     

     

    So essentially I still have two challenges I need assistance with:

    1. How can I get the date displayed next to the red arrow display the date of when the teams message was sent not the date when I click save to onenote.
    2. How can I modify the output to display something that is slightly easier to read at a glance.
      • Ideally this would be MM-DD-YYYY HH:MM:SS format, displayed in my time zone (eastern time) instead of GMT as it is currently being displayed in.

     

    Thanks!

  • v-liwei-msft Profile Picture
    on at

    Hi @Jmann223 ,

     

    For a selected message, the trigger does not return the time the message was sent. 

    Sorry for the inconvenience caused. 

    If you want to change the timezone and date format, I recommend you to use the function:

    convertTimeZone('<timestamp>', '<sourceTimeZone>', '<destinationTimeZone>', '<format>'?)

    I think this link will help you a lot:

    Reference guide for expression functions - Azure Logic Apps | Microsoft Docs

     

    Best Regards,

    Levi

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

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard