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.