SOLVED

Teams adaptive card won't open OneNote URL's

Copper Contributor

EDIT: It seems to work if you manually generate a Share URL in OneNote, but not with whatever is in the address bar.  Leave it to MS to break something as simple as a working copy/paste URL...

 

When using Action.OpenUrl in an adaptive card to Teams, if a OneNote/Sharepoint URL is used, it doesn't seem to work.  I suspect it's breaking due to having the "{" and "}" in the URLs.

 

This works fine

 

 

 

{
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "type": "AdaptiveCard",
  "version": "1.0",
  "body": [
    {
      "type": "TextBlock",
      "text": "Don't forget to update your notes for the team meeting"
    }
  ],
  "actions": [
    {
      "type": "Action.OpenUrl",
      "title": "Update Notes",
      "url": "https://google.com"
      "
    }
  ]
}

 

 

 

This does not work

 

 

 

{
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "type": "AdaptiveCard",
  "version": "1.0",
  "body": [
    {
      "type": "TextBlock",
      "text": "Don't forget to update your notes for the team meeting"
    }
  ],
  "actions": [
    {
      "type": "Action.OpenUrl",
      "title": "Update Notes",
      "url": "https://redacted.sharepoint.com/sites/redacted/_layouts/15/Doc.aspx?sourcedoc={redacted}&action=edit"
      "
    }
  ]
}

 

 

 

I'm posting this card using the Post Adaptive Card to Chat or Channel action in Power Automate.  I've also tried wrapping the URL in a encodeUrlComponent function, to no avail.

 

3 Replies
best response confirmed by plmcgrn (Copper Contributor)
Solution

Hi @plmcgrn, The sharepoint/OneNote Url should be in encoded format. If URL has '{' and '}' it does not work. Please replace '{' with '%7B' and '}' with '%7D' respectively it will work. 

Sample URL:

 

https://{domainName}.sharepoint.com/:w:/r/teams/My_Test/_layouts/15/Doc.aspx?sourcedoc=%7BF2B5321E-7CA9-468D-B628-8ECB9308F982%7D&file=Document.docx&action=default&mobileredirect=true

@plmcgrn Please let us know if your issue has been resolved.

Thank you very much, it worked great
1 best response

Accepted Solutions
best response confirmed by plmcgrn (Copper Contributor)
Solution

Hi @plmcgrn, The sharepoint/OneNote Url should be in encoded format. If URL has '{' and '}' it does not work. Please replace '{' with '%7B' and '}' with '%7D' respectively it will work. 

Sample URL:

 

https://{domainName}.sharepoint.com/:w:/r/teams/My_Test/_layouts/15/Doc.aspx?sourcedoc=%7BF2B5321E-7CA9-468D-B628-8ECB9308F982%7D&file=Document.docx&action=default&mobileredirect=true

View solution in original post