I have a WebService-Connection, with which I fetch data from a SharePoint-List. This data comes in raw data with index and separation-strings. So I wanted to change these informations prior the form displays and stores it in the form xml.

How can I do this I looked at the Changed-Event of a textbox, but in the XmlEventArgs I cannot change the property NewValue.

So how can I change the source data

Re: SharePoint - InfoPath Forms Services Changing data from a datasource prior to displaying in the form


I achieved it programmatically: You have to create a Loading-EventHandler and browse through the xml data from the URL and change this:

DataSource source = this.DataSources["Source-Name"];

XPathNavigator nav = source.CreateNavigator();

XmlNamespaceManager nsm = new XmlNamespaceManager(nav.NameTable);

nsm.AddNamespace("rs","urnTongue Tiedchemas-microsoft-com:rowset");

nsm.AddNamespace("dt", "uuid:C2F41010-65B3-11d1-A29F-00AA00C14882");

nsm.AddNamespace("z", "#RowsetSchema");

foreach (XPathNavigator attr in nav.Select("//z:row/@*", nsm))


LookupValueString lv = new LookupValueString(attr.Value);

if (lv.IsFloat())





This code cycles through all attributes of all z:row-tags, the data is provided by owssvr.dll. I have a custom class LookupValueString, which splits the string according to the separator and takes out the last part. After checking, if it's a float value, the defined operation is performed and the new value is written to the XML data.

This form is then also browser-capable, but you have to upload the form into the central administration and activate it for the websites. Also the assembly has to be installed to the GAC on the server. After that, you can add the new Content Type to a form library and use this form via Forms Services Smile