logo
Documents & Forms
Microsoft 365 & SharePoint Tools
Classic SharePoint Tools
Forms
May 07, 2018

Provision modern forms for SharePoint Online programmatically (Office365)

Customer Support Engineer

Following our recent article of how you can migrate our forms using Sharegate tool, we would like to offer an alternative way to provision our Forms programmatically. This way, you’ll have to write the code yourself, the process is not automatic, but it’s very simple and you’ll only need to have Visual Studio.NET Framework v.4.5.2 or higher and our NuGet package.

1

All you need to do is create new console application, add and download our NuGet package and its dependencies.

2

Now, you can either access one of your existing sites and get information about your existing forms and routing configuration, or you can use exported forms stored on your machine.

var mng = new FormsManager(clientContext, listId, contenTypeId);
var layout = XDocument.Load("c:\\provision\\Item_Edit.xfds");
var compiledForm = CompileForm(layout);
mng.GenerateForms(Guid.Empty, FormTypes.Edit, layout, compiledForm);

This functionality allows you to provision large number of forms to any amount of sites, and can come very handy during migration or when creating sites from template. Essentially, you don’t need to do any manual work, export and import forms one by one, and the forms can be ready to go as soon as the site is created.

To find out more, check out our article with step by step instruction for provisioning an exported form. For a more in-depth information, we have documented all the available methods and how you can use them here.

Note: The post has been originally published at Medium: