SOLVED

Teams adaptive card won't open OneNote URL's

%3CLINGO-SUB%20id%3D%22lingo-sub-2257072%22%20slang%3D%22en-US%22%3ETeams%20adaptive%20card%20won't%20open%20OneNote%20URL's%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2257072%22%20slang%3D%22en-US%22%3E%3CP%3EWhen%20using%20Action.OpenUrl%20in%20an%20adaptive%20card%20to%20Teams%2C%20if%20a%20OneNote%2FSharepoint%20URL%20is%20used%2C%20it%20doesn't%20seem%20to%20work.%26nbsp%3B%20I%20suspect%20it's%20breaking%20due%20to%20having%20the%20%22%7B%22%20and%20%22%7D%22%20in%20the%20URLs.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20works%20fine%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%7B%0A%20%20%22%24schema%22%3A%20%22http%3A%2F%2Fadaptivecards.io%2Fschemas%2Fadaptive-card.json%22%2C%0A%20%20%22type%22%3A%20%22AdaptiveCard%22%2C%0A%20%20%22version%22%3A%20%221.0%22%2C%0A%20%20%22body%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22type%22%3A%20%22TextBlock%22%2C%0A%20%20%20%20%20%20%22text%22%3A%20%22Don't%20forget%20to%20update%20your%20notes%20for%20the%20team%20meeting%22%0A%20%20%20%20%7D%0A%20%20%5D%2C%0A%20%20%22actions%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22type%22%3A%20%22Action.OpenUrl%22%2C%0A%20%20%20%20%20%20%22title%22%3A%20%22Update%20Notes%22%2C%0A%20%20%20%20%20%20%22url%22%3A%20%22https%3A%2F%2Fgoogle.com%22%0A%20%20%20%20%20%20%22%0A%20%20%20%20%7D%0A%20%20%5D%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20does%20not%20work%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%7B%0A%20%20%22%24schema%22%3A%20%22http%3A%2F%2Fadaptivecards.io%2Fschemas%2Fadaptive-card.json%22%2C%0A%20%20%22type%22%3A%20%22AdaptiveCard%22%2C%0A%20%20%22version%22%3A%20%221.0%22%2C%0A%20%20%22body%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22type%22%3A%20%22TextBlock%22%2C%0A%20%20%20%20%20%20%22text%22%3A%20%22Don't%20forget%20to%20update%20your%20notes%20for%20the%20team%20meeting%22%0A%20%20%20%20%7D%0A%20%20%5D%2C%0A%20%20%22actions%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22type%22%3A%20%22Action.OpenUrl%22%2C%0A%20%20%20%20%20%20%22title%22%3A%20%22Update%20Notes%22%2C%0A%20%20%20%20%20%20%22url%22%3A%20%22https%3A%2F%2Fredacted.sharepoint.com%2Fsites%2Fredacted%2F_layouts%2F15%2FDoc.aspx%3Fsourcedoc%3D%7Bredacted%7D%26amp%3Baction%3Dedit%22%0A%20%20%20%20%20%20%22%0A%20%20%20%20%7D%0A%20%20%5D%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20posting%20this%20card%20using%20the%20Post%20Adaptive%20Card%20to%20Chat%20or%20Channel%20action%20in%20Power%20Automate.%26nbsp%3B%20I've%20also%20tried%20wrapping%20the%20URL%20in%20a%20encodeUrlComponent%20function%2C%20to%20no%20avail.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2257072%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EMicrosoft%20Teams%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2263628%22%20slang%3D%22en-US%22%3ERe%3A%20Teams%20adaptive%20card%20won't%20open%20OneNote%20URL's%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2263628%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1018520%22%20target%3D%22_blank%22%3E%40plmcgrn%3C%2FA%3E%2C%20The%20sharepoint%2FOneNote%20Url%20should%20be%20in%20encoded%20format.%20If%20URL%20has%20'%7B'%20and%20'%7D'%20it%20does%20not%20work.%20Please%20replace%20%3CSTRONG%3E'%7B'%3C%2FSTRONG%3E%20with%20%3CSTRONG%3E'%257B'%3C%2FSTRONG%3E%20and%20%3CSTRONG%3E'%7D'%3C%2FSTRONG%3E%20with%3CSTRONG%3E%20'%257D'%3C%2FSTRONG%3E%20respectively%20it%20will%20work.%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3ESample%20URL%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3Ehttps%3A%2F%2F%7BdomainName%7D.sharepoint.com%2F%3Aw%3A%2Fr%2Fteams%2FMy_Test%2F_layouts%2F15%2FDoc.aspx%3Fsourcedoc%3D%257BF2B5321E-7CA9-468D-B628-8ECB9308F982%257D%26amp%3Bfile%3DDocument.docx%26amp%3Baction%3Ddefault%26amp%3Bmobileredirect%3Dtrue%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
New 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.

 

2 Replies
best response confirmed by plmcgrn (New 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.