private static void GetFormFromListAndSaveToFile(NfClientContext sourceContext, string sourceContentTypeId, string sourceListId, string fullFilePath) { // Read the form definition XML by invoking the GetFormXml method // from the client context for the source environment. Console.WriteLine("Getting form..."); string formXml = sourceContext.GetFormXml(sourceListId, sourceContentTypeId); Console.WriteLine("Saving form..."); File.WriteAllText(fullFilePath, formXml, Encoding.Unicode); // Display the file name of the saved form to the console. Console.WriteLine("Successfully saved form to: {0}", fullFilePath); }
private static void GetFormFromListAndPublishToList(NfClientContext sourceContext, string sourceContentTypeId, string sourceListId, NfClientContext destinationContext, string destinationContentTypeId, string destinationListId) { // Read the form definition XML by invoking the GetFormXml method // from the client context for the source environment. Console.WriteLine("Getting form..."); string formXml = sourceContext.GetFormXml(sourceListId, sourceContentTypeId); // Publish the form definition XML by invoking the PublishForm method // from the client context for the destination environment. Console.WriteLine("Publishing form..."); var result = destinationContext.PublishForm(destinationListId, destinationContentTypeId, formXml); // Display the version number of the published form to the console. Console.WriteLine("Successfully published version: {0}", result.Version); }