I need to create a List with an asset package with spfx. The list must contains 10 Columns that can not be edited by users but will be modified by buttons added with an spfx extension.

How can I do this ? Do you know if there are documentation or tutorials ?

Thank you for your time.

  • I have found the solution, in an spfx asset deployment you can add the property ReadOnly="TRUE" for a custom Field exemple : <Field ID="{0c5c0c1d-5584-46d2-97ee-7b13e7d3bb9a}" Name="SPFxAmountRO" DisplayName="Amount read only" Type="Currency" Decimals="2" Min="0" Required="FALSE" ReadOnly="TRUE" Group="SPFx Columns" /> – neothoms Dec 18 '18 at 17:06

Firs of all, here is sample that will guide you through the process of creating SPFX package with assets.

I am afraid that there is no way how to completely lock the field and change it through REST API. You create field that is hidden in new and edit forms. Unfortunately if the user add the field to a view and try to edit it in the data grid, it will be possible to modify value of the field.

<Field ID="{SOME-GUID}" Name="ColumnName" DisplayName="Column name" Type="Text" ShowInNewForm="FALSE ShowInEditForm="FALSE" />

Field reference https://docs.microsoft.com/en-us/sharepoint/dev/schema/field-element-field

Note that Hidden="TRUE" nor ReadOnly="TRUE" cannot be used.

  • Thank you for your response. Is there any other way to add ReadOnly Columns ? – neothoms Dec 17 '18 at 13:04
  • 1
    In Fact I tried the ReadOnly and it works perfectly. – neothoms Dec 18 '18 at 17:05

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