1

Using the Microsoft.SharePoint dll, I can render SP Fields in custom application page using the below server side code.

BaseFieldControl editControl = field.FieldRenderingControl;
editControl.ID = field.Id.ToString()                
editControl.ControlMode = SPControlMode.New;
editControl.ListId = list.ID;
editControl.FieldName = field.InternalName;

pnlFields.Controls.Add(editControl);

Now, we're converting our farm solutions to Addins/SPFx. I cannot find an equivalent of the above code via CSOM/JSOM. What is the way to render SP Fields in a custom page via client side programatically (Addins/SPFx) and How?

This will be used in a Batch Edit page, wherein the custom Batch Edit page contains the SP Fields visible in the default edit form of the list. And on the Batch Edit page, the user can input their updates to the items (just like entering inputs on the edit form).

JC Sent
  • 11
  • 2

1 Answers1

1

You can't find it because a FieldRenderingControl does not exist in the SPFx world :)

I would highly recommend this sample to see how to dynamically render fields: https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples/react-list-form

It shows you how to read the list schema and render fields accordingly. You will have to render each field yourself, as well as handle any storing of data after an update. In the sample they have added code for most fieldtypes.

You can also batch these update calls (as you mention batch edit in your question) using the Microsoft graph: https://learn.microsoft.com/en-us/graph/json-batching

This will save you a bunch of requests as you can do 20 item updates per call by using this.

Judith
  • 74
  • 7