Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

help reading in xml from infopath library

$
0
0

hi,

I have InfoPath forms in a library, but am having trouble reading the xml into memory.  I am trying to do this from an application running on a client computer to process timesheets. 

 Dim siteUrl As String = SERVER_NAME

        Dim clientContext As New ClientContext(siteUrl)
        Dim oList As List = clientContext.Web.Lists.GetByTitle("Timesheets")
        Dim camlQuery As New CamlQuery()
        camlQuery.ViewXml = "<View/>"

        Dim collListItem As ListItemCollection = oList.GetItems(camlQuery)
        clientContext.Load(collListItem)
        clientContext.ExecuteQuery()

        Dim oListItem As ListItem
        Dim oFile As Microsoft.SharePoint.Client.File

        For Each oListItem In collListItem
            Console.WriteLine("ID: {0} " + ControlChars.Lf + "Title: {1} " + ControlChars.Lf & "", oListItem.Id, oListItem("Title"))
            Console.WriteLine(oListItem.FieldValues("Timesheet_x0020_Date"))

            If oListItem.FieldValues("Timesheet_x0020_Date") >= fromDate And oListItem.FieldValues("Timesheet_x0020_Date") <= toDate Then

                '     reader = New XmlTextReader( oListItem.File.OpenBinaryDirect(clientContext,SERVER_NAME)

                Dim serializer2 As New XmlSerializer(GetType(TimesheetFields))
                tsFields = DirectCast(serializer2.Deserialize(reader), TimesheetFields)

the error comes on the commented line that uses the xmltextreader object.  i can seem to access the list, because those console.writeline entries work, and read the date and title of the document.  i have already xsd.exe'd the dataset from the infopath document (TimesheetFields) as a class.  I just seem to be having trouble reading the file so i can serialize it to the tsFields object.

thanks so much for your help!


~george



Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>