Forum Discussion
Anders_Poulsen_RG
Jun 14, 2024Copper Contributor
Document hyperlink from document properties
Do you have any ideas to create a Hyperlink from document properties in modern view as it is in classic view? See examples below
Modern mode:
Classic mode:
- Make use of column formatting Json:
https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/list-form-configuration
Have a Href to the file!- Anders_Poulsen_RGCopper Contributor
NicolasKheirallah thank you very much
I am able to create a link in the header but i can not get a dynamic href link to the current document. (see json below the picture)
The current href returns: https://royalgreenland.sharepoint.com/sites/BusinessProcessModel/sites/Test%20af%20brugerdefineret%20visning/Forms/AllItems.aspx?ID=1
And I want it to return:
{
"elmType": "div",
"attributes": {
"class": "ms-borderColor-neutralTertiary"
},
"style": {
"width": "99%",
"border-top-width": "0px",
"border-bottom-width": "1px",
"border-left-width": "0px",
"border-right-width": "0px",
"border-style": "solid",
"margin-bottom": "16px"
},
"children": [
{
"elmType": "div",
"style": {
"display": "flex",
"box-sizing": "border-box",
"align-items": "center"
},
"children": [
{
"elmType": "div",
"attributes": {
"iconName": "link",
"class": "ms-fontSize-42 ms-fontWeight-regular ms-fontColor-themePrimary",
"title": "Details"
},
"style": {
"flex": "none",
"padding": "0px",
"padding-left": "0px",
"height": "36px"
}
}
]
},
{
"elmType": "div",
"attributes": {
"class": "ms-fontColor-neutralSecondary ms-fontWeight-bold ms-fontSize-24"
},
"style": {
"box-sizing": "border-box",
"width": "100%",
"text-align": "left",
"padding": "21px 12px",
"overflow": "hidden"
},
"children": [
{
"elmType": "a",
"txtContent": "Click here for details",
"attributes": {
"href": "= @currentWeb + '/sites/Test%20af%20brugerdefineret%20visning/Forms/AllItems.aspx?ID=' + [$ID] ",
"target": "_blank"
}
}
]
}
]
}- You need to use $FileLeafRef BUT there's a bug where it returns 0/blank...