Haraka Hit: Kusoma InfoPath XML moja Kutoka SPListItem katika 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 (ambayo ni haki ya XML files, hivyo ni kweli kabisa rahisi).

Wakati mimi ilikuwa kujenga mradi, I started by downloading an InfoPath form and saving it to my local hard drive. My c# code was reading directly from that instance. Hata hivyo, 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. Hata hivyo, there’s no need to go through those hoops as you can read it directly from the library. This little snippet shows how:

/// Hatari ufafanuzi mambo hapa, ikiwa ni pamoja na:
binafsi SPFile mySharePointFile; /* Sehemu ya SPList */
// Zaidi ya kanuni huenda hapa na ndani ya njia ya darasa tuna:
XmlTextReader textReader;
textReader = mpya XmlTextReader(mySharePointFile.OpenBinaryStream());

textReader.WhitespaceHandling = WhitespaceHandling.Hakuna;

textReader.Read();

// Kama nodi ina thamani

wakati (textReader.Read())
{

… and so on and so forth …

Wao muhimu kidogo hapo juu ni kwamba tunaweza kusoma InfoPath moja kwa moja kupitia OpenBinaryStream() method call on the SPFile as a parameter to the constructor on XmlTextReader. It works great.

</mwisho>

Kujiunga na blog yangu.

Kufuata yangu juu ya Twitter kwa http://www.twitter.com/pagalvin

Tags technorati:

Wazo moja juu ya "Haraka Hit: Kusoma InfoPath XML moja Kutoka SPListItem katika SharePoint

  1. nesreen

    hi,
    Mimi haja ya kusaidia katika hili , Nina SharePoint 2007 tovuti na InfoPath na meza ya kurudia , nini mimi haja ya kufanya ni mara moja fomu ni kuokolewa kwa maktaba SharePoint aina nahitaji kitanzi na kuokoa data kwenye orodha ya kutumia SP fomu maktaba tukio handler.

    Msaada wowote ni kweli appreciated.

    Shukrani

    Kujibu

Kuondoka Reply

Anwani yako si kuchapishwa. Mashamba required ni alama *