I have set a field as read-only using this PnP script, the field is of type "image or hyperlink":-
$fieldTitle = "LinkToRiskValue"
$customfield = $Context.Site.RootWeb.Fields.GetByInternalNameOrTitle($fieldTitle)
$customfield.ReadOnlyField = $true;
$customfield.UpdateAndPushChanges($true);
$Context.ExecuteQuery();
now i thought that this will prevent updating the item inside my CSOM code, but seems i can do this operation:-
context.Load(context.Site);
context.ExecuteQuery();
listItem["LinkToRiskValue"] = context.Site.Url+"/Lists/RiskValue/AllItems.aspx?FilterField1=RiskValueAsset&FilterValue1=" + listItem["Title"] + "&FilterType1=Lookup";
listItem.Update();
context.ExecuteQuery();
so does this mean that i can update a Read-Only field using CSOM?