Use code to obtain infopath form data in a Sharepoint site

Source: Internet
Author: User

How to Use infopath as the enterprise process data input ClientCodeIt is required to access the content of the infopath form stored in the SharePoint form library.

To sum up, the key points are as follows:

1. Get the spfile object corresponding to the infopath form. This is not detailed in detail, whether it is the form library event processing code, or external applicationsProgramFirst, you must obtain the spfile object representing the infopath form.

2. Read all the content in the infopath form into a stream:
Stream stream = new memorystream (file. openbinary ());

3. Access form data through the XML interface. A reader reads the content in the stream in the form of text, and obtains the string representation of the XML document containing all the data in the form. Through xmldocument, XPath and Other interfaces, you can retrieve the information you need step by step.

4. If you really hate dealing with a bunch of XML data through the XML interface, use the more OO method below.
First, put the original infopath. decompress the xsn file to describe the data architecture of the form. find the XSD file, and then use. net framework' xsd.exe command line tool, through this. get a proxy class from the XSD file and use this class in the project. For example, for a work order form, we get a workitem class:
Workitem = new xmlserializer (typeof (workitem). deserialize (Stream) as workitem;
Deserialize the content of the infopath form into an object, and then directly access the attributes of this object.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.