Using SPO, I can get JSON column formatting to work on my library. However, any formatting I apply to the "Shared With" column works in preview mode but does not save with the view.
I think this is because it's a "special" column that the library is generating for the subfolders, rather than a normal library/list column.
Has anyone managed to apply column formatting to this column and get it to persist? Here's the code I'm using, which works beautifully but doesn't stick. I've also tried simpler code that works on other columns but not on the "Shared With" column.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style": {
"min-height": "1.5em",
"flex-direction": "column",
"align-items": "start",
"padding-top": "4px",
"padding-bottom": "4px"
},
"children": [
{
"elmType": "div",
"txtContent": "=length(@currentField)",
"style": {
"border-radius": "1.5em",
"height": "1.5em",
"min-width": "1.5em",
"color": "white",
"text-align": "center",
"position": "absolute",
"top": "4px",
"right": "1em",
"background-color": "=if(length(@currentField) == 1, '#3c3', '#33c'"
}
},
{
"elmType": "div",
"forEach": "person in @currentField",
"style": {
"justify-content": "center"
},
"children": [
{
"elmType": "div",
"style": {
"display": "flex",
"flex-direction": "row",
"justify-content": "center"
},
"children": [
{
"elmType": "a",
"attributes": {
"href": "[$person.email]"
},
"style": {
"margin-left": "0.5em"
},
"children": [
{
"elmType": "div",
"txtContent": "[$person.title]",
"style": {
"font-size": "1.2em"
}
}
]
}
]
}
]
}
]
}