Forum Discussion
SharePoint Online column level permission
I realize this is an old thread but if it helps others in the future, the only way to do this is to setup separate lists, one which has the column and the other which does not. Then use Power Automate or Event Receivers to synchronize information between the two lists. This is the only true way of "mimicking" column level permissions.
HTH!
I found one workaround using modern sharepoint column formatting. I was able to use the following code to only show column values to the listed users in the display parameter:
{"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"children": [{
"elmType": "span",
"txtContent": "@currentField",
"style": {
"display": "=if(@me=='email address removed for privacy reasons' || me=='email address removed for privacy reasons' , '', 'none')"}}]}
I also had to add conditional formulas to each column I wanted to restrict so that they do not show in the new item/edit item forms. The formula is similar to the display parameter above:
=if(@me=='email address removed for privacy reasons' || me=='email address removed for privacy reasons' , true, false)
Now for the caveats!
1. In my case, most of the columns I am hiding are choice columns. If a person who is restricted happens to open the list in a Quick Edit view (grid view), they could actually manipulate the hidden values.
In Quick Edit mode (also in the new item/edit item form if you do not hide using a conditional formula), when they click on that column, it shows a collapsed and blank dropdown but when they hover over the dropdown, it pops up a tooltip with that hidden value and it allows the user to select it. The value is not visible in the field after they select it but it has in fact been saved as an updated value. I simply disabled Quick Edit mode to resolve this issue.
2. You will want to disable the ability for the user to create personal list views. If not, they could create their own Quick Edit view and affect the restricted fields.
3. I have yet to find a way to create a centralized list of users instead of hard coding it every time in every column formatting field as shown. There has to be a better way! If someone has a better solution, please let me know!