Form sets are important. They contain Form Panel and List View settings, plus routing configuration, including groups used for redirection.
This article will show you how to work with FormSetSettings when provisioning forms.
Here’s an example how you can retrieve existing Form Set Settings:
var forms = new FormsDesigner.SharePoint.FormsManager(ctx, list.Id, contentType.Id.ToString());
var fs = forms.GetFormSets();
Important
Only available after customization of Form sets, for example, adding new Form Set or customizing the Panel.
Here’s an example how you can create new Form Set Settings:
var fs = new FormSetSettings(){
CustomRouting = "//JS code for custom routing",
CustomListViewStyle = "//CSS code to apply in List View"
};
Here’s an example how you can create new Form sets:
fs.FormSets = new FormSet[]{
new FormsDesigner.Data.SharePoint.FormSet()
{
Id = new Guid(),
Title = "FormSet1",
ExcludedGroupIds = new int[] { 1, 2, 3},
IncludedGroupIds = new int[] { 4, 5, 6 },
Order = 1
},
new FormsDesigner.Data.SharePoint.FormSet()
{
Id = new Guid(),
Title = "FormSet2",
IncludedGroupIds = new int[] { 4, 5, 6 },
Order = 2
}
};
Here’s an example how you can create new Panel settings:
fs.Panel = new FormTypePanelSettings(){
New = new FormPanelSettings(FormPanelSize.Small),
Edit = new FormPanelSettings(FormPanelSize.Medium),
Display = new FormPanelSettings(FormPanelSize.Large)
};
Here’s an example how you can set Form Set settings after configuring them:
var formsNewSite = new FormsDesigner.SharePoint.FormsManager(ctx, list.Id, contentType.Id.ToString())
formsNewSite.SetFormSets(fs);