cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jesslynh
Resolver I
Resolver I

HTML format in table

I am creating an HTML table to email periodically w links to the individual items in SharePoint.  Is there any way to replace the long, ugly SharePoint link with a shorter hyperlink?

 

I tried to be clever and use <a href, but it doesn't work.

1 ACCEPTED SOLUTION

Accepted Solutions
David-
Solution Supplier
Solution Supplier

I am not sure if you resolved your problem with generating a user-friendly link when generating an HTML table. After your "Create HTML table" action, add a Compose action with the following Expression: 

replace(replace(replace(body('Create_HTML_table'),'&lt;','<'),'&gt;','>'),'&quot;','"')

That should do the trick for you.

 

Regards,

David

 

View solution in original post

6 REPLIES 6
eliotcole
Super User
Super User

Hi, @jesslynh, what SharePoint link are actually referring to?

 

It might be a good idea to:

  1. Upload pictures of your flow (expand as many actions as possible)
  2. Include some sample data for whomever assists you to get an idea of what is needed

You can obfuscate where necessary, but it really helps provide context not just to those helping, but to those who maybe have the same or similar issues.

jesslynh
Resolver I
Resolver I

I'm using the 'Link to Item' returned by SharePoint.

jesslynh
Resolver I
Resolver I

Here is a view of my flow.  I tried this a couple of ways

The HTML table 2 is using the output of the Select statement

D-1027.pngD-1026.pngUsed href from SelectUsed href from SelectUsing the href formatUsing the href format

v-yujincui-msft
Community Support
Community Support

Hi @jesslynh ,

 

Maybe you could write the HTML code manually, i have made a test for your reference.

 

1. Here is my SharePoint List.

vyujincuimsft_0-1656317033783.png

2. Here is my Flow.

  <tr>
    <td>Dynamic Content</td>
    <td>Dynamic Content</td>
    <td><a href="@{items('Apply_to_each')?['{Link}']}">Link</a></td>
  </tr>
<!DOCTYPE html>
<html>
<style>
table, th, td {
  border:1px solid black;
}
</style>
<body>

<h2>Report Test</h2>

<table>
  <tr>
    <th>ColumnName1</th>
    <th>ColumnName2</th>
    <th>Link</th>
  </tr>
@{variables('varhtml')}

</table>

</body>
</html>

vyujincuimsft_1-1656317098808.png

vyujincuimsft_2-1656317148610.png

Result Screenshot:

vyujincuimsft_3-1656317351070.png

 

 

Best Regards,

Charlie Choi

eliotcole
Super User
Super User

OK, well, @jesslynh ... to make a super simple sharePoint link to an item all you have to do is construct it using the site, the list name, and the ID.

 

A concat() function in an expression can build an item link, which will then display accordingly.

 

The below first example shows placeholders which are case sensitive, but you can get these dynamically, see my example for you afterwards:

concat(
	'https://YOUR_DOMAIN.sharepoint.com/sites/YOUR_SITE/Lists/YOUR_LIST/DispForm.aspx?ID=',
	ITEM_ID
)
For example, your Select action:
concat(
	split(
		item()?['{Link}'],
		'_layouts'
	)[0],
	'DispForm.aspx?ID=',
	item()?['ID']
)

 

Hopefully that's not too daunting, but all I did there, was take the start of the link, before it gets complex, and then add the part which brings up an item on the screen.

 

Broken down that's:

  1. The split() function:
    1. Splits the link text into an array by looking for the string "_layouts" inside that text
    2. Then by placing [0] after the split array that selects the first array entry
  2. The concat() then simply splices together:
    1. ... that text
    2. ... with "DispForm.aspx?ID="
    3. ... and finally the ID number of the list item

🙂

 

This will work for anyone that has access to the list / item, of course.

 

---

 

There are more complex ways of handling this (in my head there's a shortcode generator, but that's a project), but that's the most simple, and it's even shorter than the 'coded' ones that SharePoint insists on generating for you when you're inside a list.

 

I've delved into the coded ones in this answer, here:

https://powerusers.microsoft.com/t5/Building-Flows/Move-my-list-hyperlink-from-SharePoint-site-to-an...

 

David-
Solution Supplier
Solution Supplier

I am not sure if you resolved your problem with generating a user-friendly link when generating an HTML table. After your "Create HTML table" action, add a Compose action with the following Expression: 

replace(replace(replace(body('Create_HTML_table'),'&lt;','<'),'&gt;','>'),'&quot;','"')

That should do the trick for you.

 

Regards,

David

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (3,532)