1

Is there any way to get the URL from a Link file/item on JSON Column Formatting?

When creating a Link file/item, you need to add a URL, like below, that's the one I'm looking to get on the formatting:

The URL put here, when creating a Link item

1 Answer 1

1

Yes, it is possible to get the URL from a Link file (.url file) using JSON Column Formatting.

You can get it using this property: [$_ShortcutUrl]. This is an internal name of field which stores the underlying URL for your Link page/item.

Example:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
  "txtContent": "[$_ShortcutUrl]"
}

Here's the output:

enter image description here

4
  • Using this [$_ShortcutUrl] is not returning anything to me, just blank. As a text, I'm editing the txtContent of a new single line text column I created only for tests, so it's written exactly like your example. Am I missing something?
    – Vann
    Commented Apr 18, 2023 at 15:26
  • Can you add screenshot where are you adding JSON? Also add the current code you are using just to see if anything is missed in JSON. Add it to your original question by editing it. Commented Apr 18, 2023 at 16:01
  • 1
    Sorry, I am just trying it now again and it's working. That works exactly like I wanted. Thank you very much. :)
    – Vann
    Commented Apr 19, 2023 at 10:46
  • You're welcome, glad it helped you! Commented Apr 19, 2023 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.