Provisioning Form Set and Form Display settings
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.
Get Form Set Settings
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.
Form Display settings
Here’s an example how you can create new Form Display settings:
var fs = formsManager.GetFormSets();
fs.DisplaySettings = new FormTypeDisplaySettings()
{
Display = FormDisplaySettings.PanelMedium,
Edit = FormDisplaySettings.DialogLarge,
New = FormDisplaySettings.Fullscreen
};
Create new Form Set Settings
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"
};
Set Form sets
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
}
};
Form Set settings
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);