pnp / pnp/List-Formatting

New sample because a document library in aTeams tab doesn't load URLs properly for .url items.

Open
#751 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

💡 Enhancement
Dominant language
PowerShell
Stars
2.2k
Forks
928
Avg merge
4d 13h
Merged PRs (30d)
1

Description

Sample (which sample are you talking about)

I'm talking about a new sample using the 'Name' column in document libraries.

Suggestion (the more details, the better)

Currently, when you click on a .url 'file' in a Teams tab, the URL doesn't load and nothing happens. I'd love to suggest that be patched, but in the meantime, I wrote a column format for the Name column in document library that behaves and looks normal for all other files types, but if the file extension ends with '.url', it loads a standard tag that looks the same in the library but loads the correct shortcut URL in a new browser window with the href attribute and target is _blank. Testing indicates this works pretty well and overrides the default buggy behaviour in a Teams tab, without affecting anything else, if even looks the same.

The list of classes is just the default list of classes for a document library's Name column, so it looks and behaves the same as an ordinary name column in a document library. If you think I should post this bug somewhere Microsoft devs can see it, I'm happy to do that as well, but in the meantime, this is my fix.

Here is the formatting:

{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"children": [
{
"elmType": "a",
"attributes": {
"class": "ms-Link root_137a7565 nameField_c45bee6b clickable_c45bee6b overflow_85ed223c pre_85ed223c",
"href": "[$_ShortcutUrl]",
"target": "_blank"
},
"style": {
"display": "=if(endsWith([$FileLeafRef], '.url'), 'grid', 'none'",
"vertical-align": "middle"
},
"txtContent": "[$FileLeafRef]"
},
{
"elmType": "button",
"attributes": {
"class": "ms-Link root_137a7565 nameField_c45bee6b clickable_c45bee6b overflow_85ed223c pre_85ed223c"
},
"style": {
"display": "=if(endsWith([$FileLeafRef], '.url'), 'none', 'grid'",
"vertical-align": "middle"
},
"txtContent": "[$FileLeafRef]",
"customRowAction": {
"action": "defaultClick"
}
}
]
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the column-formatting JSON provided in issue #751 and compare its structure with existing List-Formatting samples. Add a sample for the document-library Name column that handles .url items in Teams while preserving normal behavior for other files, then verify the displayed link and target behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
content, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.