Wednesday 19 October 2011

Programmatically set Infopath Form template for xmlformview web part

Here is a small tip on how to set the Infopath 2010 Form template for an xmlformview web part using the Object model.

Get XMlFormView WebPart

// Set the template location for new forms
String templateLib = "FormServerTemplates";
String xsnName = "template.xsn"; ->> form template Name

//Set xsnlocation location for formview
formView.XsnLocation = String.Format("{0}/{1}/{2}", SPContext.Current.Web.Url, templateLib, xsnName);

No comments:

Post a Comment