How to use the XmlFormView component displayed Info Path *.xsn file within VisualWebPart
I have followed the instructions described in the Publish a InfoPath 2010 form to Form Library in SharePoint 2010 tutorial and successfully published the InfoPath 2010 form in Form Library in Sha开发者_如何转开发rePoint 2010.
I want to develop a custom VisualWebPart that uses the XmlFormView component displayed Info Path *.xsn file. I have configured my XmlFormView in the following manner:
<cc1:XmlFormView … XsnLocation="/FormServerTemplates/*.xsn">
</cc1:XmlFormView>
When I embed my custom VisualWebPart onto any page, I encounter the following error:
w3wp.exe (0x1454)
0x1594
InfoPath Forms Services
Runtime
e568
Verbose
Unexpected exception while getting file at:
http://SharePointUrl/FormServerTemplates/*.xsn.
Exception of type:SPException. Message:Cannot open file "FormServerTemplates/*.xsn".be9cb443-292a-4c80-9188-06a01e6393c5
*.xsn will not work, you will have to specify specific infopath form teamplate.
Found a solution in the “Publishing and Deploying Using the InfoPath Wizard -> Publishing Form Templates as a Separate Content Type” article of the “SharePoint 2010 as a Development Platform” book:
In the Publishing wizard you will be asked to specify a location and file name for your form template. You can specify any document library within the site to which your content type will be published. However, the best location for your form templates is a library called Form Templates within your site. This library is available in every site and can be accessed by the path /FormServerTemplates.
Specify a location and file name for the form template:
http://SharePointUrl/FormServerTemplates/*.xsn
<cc1:XmlFormView … XsnLocation="/FormServerTemplates/*.xsn">
</cc1:XmlFormView>
精彩评论