Hi
I have a RichText column in a SharePoint list where users enter Hyperlinks. one or many.
The data i have gotten out is the following.
Unformatted data
<div class="ExternalClassB970DA15388D4825835915ED4047D6F0"><div style="font-family:Calibri, Arial, Helvetica, sans-serif;font-size:11pt;color:rgb(0, 0, 0);"><span style="color:rgb(255, 255, 255);"><div style="margin-top:14.6667px;margin-bottom:14.6667px;"><a href="https://google.se/" title="File 1">File 1</a><div style="margin-top:14.6667px;margin-bottom:14.6667px;"><a href="https://google.com/" title="File 2">File 2</a><br></div><br></div><div style="margin-top:14.6667px;margin-bottom:14.6667px;"><a href="/sites/removed/_layouts/15/google.se" title="File 1"></a></div></span></div></div>
I then use a HTML to text
First file [https://google.com/]Second file [https://google.se/]
/sites/removed/_layouts/15/google.se
Then Compose = uriComponent(body('Html_to_text'))
First%20file%20%5Bhttps%3A%2F%2Fgoogle.com%2F%5DSecond%20file%20%5Bhttps%3A%2F%2Fgoogle.se%2F%5D%0A%0A%0A%0A%2Fsites%2Fremoved%2F_layouts%2F15%2Fgoogle.se%0A%0A
Then Compose = split(outputs('Compose_-_URI_Encode'),'%0A')
[
"First%20file%20%5Bhttps%3A%2F%2Fgoogle.com%2F%5DSecond%20file%20%5Bhttps%3A%2F%2Fgoogle.se%2F%5D",
"",
"",
"",
"%2Fsites%2Fremoved%2F_layouts%2F15%2Fgoogle.se",
"",
""
]
Then Compose = decodeUriComponent(first(outputs('Compose_-_Split_Encoded_Line_Break')))
"First file [https://google.com/]Second file [https://google.se/]"
For Hyperlinks to work and display correctly in a Teams Adaptive card the following format is needed.
[I'm an inline-style link](https://www.google.com)
Can anyone help me achieve this?
Solved! Go to Solution.
Hi @JimmyWork ,
Do you want to convert a string into an array of a specific format?
I have made a test for your reference.
split(replace(outputs('Compose'),'"',''),']')
take(outputs('Compose_2'),add(length(outputs('Compose_2')),-1))
split(substring(item(),0,add(length(item()),-1)),'[')
concat('[',trim(first(outputs('Compose_4'))),'](',last(outputs('Compose_4')),')')
Result Screenshots:
Best Regards,
Charlie Choi
This should work for you:
Code:
Select From:
range(0,length(xpath(xml(replace(outputs('Compose'), '<br>', '')), '//*/@href')))
Select Title:
replace(substring(xpath(xml(replace(outputs('Compose'), '<br>', '')), '//*/@title')[item()], 7), '"', '')
Select URL:
replace(substring(xpath(xml(replace(outputs('Compose'), '<br>', '')), '//*/@href')[item()],6), '"', '')
Output Produced:
[
{
"Title": "File 1",
"URL": "https://google.se/"
},
{
"Title": "File 2",
"URL": "https://google.com/"
},
{
"Title": "File 1",
"URL": "/sites/removed/_layouts/15/google.se"
}
]
Blog: tachytelic.net
YouTube: https://www.youtube.com/c/PaulieM/videos
If I answered your question, please accept it as a solution 😘
To keep it simple how can I turn this.
"First file [https://google.com/]Second file [https://google.se/]"
Into this.
[First file](https://www.google.com),
[Second file](https://www.google.se)
Hi @JimmyWork ,
Do you want to convert a string into an array of a specific format?
I have made a test for your reference.
split(replace(outputs('Compose'),'"',''),']')
take(outputs('Compose_2'),add(length(outputs('Compose_2')),-1))
split(substring(item(),0,add(length(item()),-1)),'[')
concat('[',trim(first(outputs('Compose_4'))),'](',last(outputs('Compose_4')),')')
Result Screenshots:
Best Regards,
Charlie Choi
This should work for you:
Code:
Select From:
range(0,length(xpath(xml(replace(outputs('Compose'), '<br>', '')), '//*/@href')))
Select Title:
replace(substring(xpath(xml(replace(outputs('Compose'), '<br>', '')), '//*/@title')[item()], 7), '"', '')
Select URL:
replace(substring(xpath(xml(replace(outputs('Compose'), '<br>', '')), '//*/@href')[item()],6), '"', '')
Output Produced:
[
{
"Title": "File 1",
"URL": "https://google.se/"
},
{
"Title": "File 2",
"URL": "https://google.com/"
},
{
"Title": "File 1",
"URL": "/sites/removed/_layouts/15/google.se"
}
]
Blog: tachytelic.net
YouTube: https://www.youtube.com/c/PaulieM/videos
If I answered your question, please accept it as a solution 😘
@Paulie78 This was so clean, will have to read up on how this works, do you have any links that will help me understand your solution?
Really the secret to it is in the xml and xpath expressions, which are very powerful but rarely used. I might actually make a video about it using your example, as the example.
But if you want to have a go at it, try using the XML expression on your unformatted data, and you will soon see that it does not work. The reason is because it contains unclosed BR tags, which is why I replaced them.
Once XML works it opens you to being able to use xpath. With xpath we can extract the value of attributes.
The final part was just cleaning up the output of xpath.
How you then procced to make the output in the correct format, I did try another select where I just added[Title](URL)
The output then becomes.
{ "Link": "[AnotherFile 2](https.//google.com)" },
When using this in an adaptivecard They only support this format.
The n\n\ need to be there to create the new line break in the adaptive card for each link
[AnotherFile 1](https.//google.com)\n\n[AnotherFile 2](https.//google.com)\n\n\[AnotherFile 3](https.//google.com)
I finally achieved what I wanted and your part simplified it so much.
I can't think to help that the rest of my flow complicates what I'm trying to do.
If you have the time to look it thru please do so, it's working but it's awfully long 🙂
First part was the part you solved where I actually get and extract the links.
Second part is that the links contain Microsoft own added format for example.
/:u/r/sites/somesite/image.jpeg
/:i:/r/sites/somesite/file.svg
So I needed a way to replace all those formats to https://myrealadress.com/sites/xxxxxxxx
To achieve this I did the following.
Created the three variable below and then an "Apply to each" where I loop thru all the links and replace the Microsoft formatted links.
I also needed to remove any duplicate links because it will always create the first link as a duplicate in the data I pull. For this I used a compose.
union(body('Select'),body('Select'))
At last I needed to format the data so it works with the teams Adaptative card markdowns for links.
I created a new string variable named Links.
Then I did another apply to each where I add the needed format and join the title and URL, I also add two new line breaks due to the adaptive card markdowns needs two to create the second link in a new line.
At the end I finish with a Html to text and a compose.
uriComponentToString(variables('TempLinks'))
My finished output looks like this and it works in adaptive cards for Teams
[First file test 1](https://mywebsite.sharepoint.com/sites/demo/Illustrations/150Hz_modulation_predominant.svg?csf=1&web=1&e=x5PeM7)
[AnotherFile 2](https://mywebsite.sharepoint.com/sites/demo/Illustrations/787_in-trail_procedures.png?csf=1&web=1&e=g2akek)
[Vide file test](https://mywebsite.sharepoint.com/sites/demo/Videos/RPReplay_Final1582536602/RPReplay_Final1582536602.MP4?csf=1&web=1&e=iinGSu)
Final result looks like this.
To be honest, I think you have done well. For sure the flow is more complicated than it needs to be, but I don't think that really matters.
I do think it would be possible to do the entire thing in one, or perhaps two steps using the approach I took above. But is there really that much need for the added simplicity in the flow? If what you have done works, then it is a good flow 😀
@Paulie78 Thank you again for answering.
Reason for simplicity would be for myself to improve my won knowledge and even if the flow works I'm not happy with how long it turned out, but at least I can check each part if something fails 🙂
Dear Community Members, We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd. During this period, members will not be able to Kudo, Comment, or Reply to any posts. On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities. What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!
We are excited to announce the Summer of Solutions Challenge! This challenge is kicking off on Monday, June 17th and will run for (4) weeks. The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities. Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”) - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024 Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods. You must enter into each weekly Entry Period separately. How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different. Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers. At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing. Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner. A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random. Individuals will be contacted before the announcement with the opportunity to claim or deny the prize. Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners. Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event. ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE** Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24 17 @Anil_g 7 @ManishSolanki 13 @eetuRobo 5 @David_MA 10 @VishnuReddy1997 5 @SpongYe 9JhonatanOB19932 (tie) @Nived_Nambiar 8 @maltie 2 (tie) @PA-Noob 2 (tie) @LukeMcG 2 (tie) @tgut03 2 (tie) Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate @Deenuji 12@ManishSolanki 19 @Anil_g 10 @NathanAlvares24 17 @VishnuReddy1997 6 @Expiscornovus 10 @Tjan 5 @Nived_Nambiar 10 @eetuRobo 3 @SudeepGhatakNZ 8 Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22 Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2 Anil_g2 SharonS2
On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners. The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights. Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.
We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for. We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer. Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together. Here's to new beginnings and endless possibilities! If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport. To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages