Quick Hit: Qari InfoPath XML direttament minn SPListItem fl SharePoint

I’m been working on a project where I need to extract attachments from an InfoPath form. There are some good resources for parsing InfoPath forms (li huma biss fajls XML, dan huwa attwalment pjuttost faċli).

Filwaqt I kien bini l-proġett, I started by downloading an InfoPath form and saving it to my local hard drive. My c# code was reading directly from that instance. Madankollu, the InfoPath forms are really living inside a SharePoint forms library. I did a little half hearted searching to find out how to read it directly from the library and almost gave up, in which case I would have saved the form to a local temp directory and read it from there. Madankollu, there’s no need to go through those hoops as you can read it directly from the library. This little snippet shows how:

/// Jittieħed klassi definizzjoni hawn, inklużi:
privat SPFile mySharePointFile; /* Parti minn SPList */
// Aktar kodiċi tmur hawn u ġewwa metodu tal-klassi għandna:
XmlTextReader textReader;
textReader = ġdid XmlTextReader(mySharePointFile.OpenBinaryStream());

textReader.WhitespaceHandling = WhitespaceHandling.Xejn;

textReader.Read();

// Jekk il-node għandha valur

filwaqt li (textReader.Read())
{

… and so on and so forth …

Huma bit ewlieni hawn fuq hija li nistgħu taqra l-InfoPath direttament permezz tal-OpenBinaryStream() method call on the SPFile as a parameter to the constructor on XmlTextReader. It works great.

</aħħar>

Abbona għall-blog tiegħi.

Follow lili Twitter fi http://www.twitter.com/pagalvin

Tags:

Wieħed ħasbu dwar "Quick Hit: Qari InfoPath XML direttament minn SPListItem fl SharePoint

  1. nesreen

    hi,
    I bżonn għajnuna f'dan , Għandi Sharepoint 2007 sit u InfoPath ma 'tabella tirrepeti , dak I bżonn tagħmel huwa meta l-formola tiġi ffrankati l-forom librerija SharePoint I bżonn loop u jiffrankaw l-data għal lista tuża SP forma librerija handler avveniment.

    Kwalunkwe għajnuna huwa apprezzat verament.

    Grazzi

Ħalli Irrispondi

Your email address mhux se jkun ippubblikat. Meħtieġa oqsma huma mmarkati *