آمار سریع: خواندن InfoPath XML به طور مستقیم از SPListItem در شیرپوینت

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 (که فقط فایل های XML, پس از آن در واقع بسیار آسان است).

در حالی که من در حال ساخت پروژه, I started by downloading an InfoPath form and saving it to my local hard drive. My c# code was reading directly from that instance. اما, 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. اما, there’s no need to go through those hoops as you can read it directly from the library. This little snippet shows how:

/// چیزهای تعریف کلاس در اینجا, از جمله:
خصوصی SPFile mySharePointFile; /* بخشی از یک SPList */
// کد های بیشتر در اینجا و در داخل یک متد از کلاس ما می رود:
XmlTextReader textReader;
textReader = جدید XmlTextReader(mySharePointFile.OpenBinaryStream());

textReader.WhitespaceHandling = WhitespaceHandling.هیچ یک;

textReader.Read();

// اگر گره دارای ارزش

در حین (textReader.Read())
{

… and so on and so forth …

آنها کمی کلیدی بالا است که ما می توانیم InfoPath به طور مستقیم از طریق OpenBinaryStream به عنوان خوانده شده() method call on the SPFile as a parameter to the constructor on XmlTextReader. It works great.

</پایان>

مشترک شدن در وبلاگ من.

من در توییتر در http://www.twitter.com/pagalvin

برچسب ها:

یکی در "آمار سریع: خواندن InfoPath XML به طور مستقیم از SPListItem در شیرپوینت

  1. nesreen

    سلام,
    من نیاز به کمک در این , من شیرپوینت 2007 سایت و infopath با تکرار یک جدول , آنچه که من باید انجام دهید این است یک بار فرم به کتابخانه شیرپوینت اشکال ذخیره من به حلقه نیاز و صرفه جویی در داده ها به یک لیست با استفاده از SP فرم event handler برای کتابخانه.

    هر گونه کمک است که واقعا قدردانی.

    سپاس ها

    پاسخ

پاسخ

آدرس ایمیل شما منتشر نخواهد شد. بخشهای موردنیاز علامتگذاری شدهاند *