How to Edit InfoPath XML File in Forum Library Programmatically in SharePoint 2007

The below lines of code snippet is to update the infopath xml record(file)

SPWeb _web = SPContext.Current.Web; SPList _list = _web.Lists[“SampleFormLib”];

MemoryStream myInStream = new MemoryStream(item.File.OpenBinary()); XmlTextReader reader = new XmlTextReader(myInStream);

XmlDocument doc = new XmlDocument(); doc.Load(reader);

reader.Close(); myInStream.Close();

XmlNamespaceManager nameSpaceManager = new XmlNamespaceManager(doc.NameTable); nameSpaceManager.AddNamespace(“my”, “http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-06-11T12:44:57“);

doc.DocumentElement.SelectSingleNode(“my:Status”, nameSpaceManager).InnerText = “Saved”; […]

“The file has been modified by SHAREPOINT\system” Error while Updating InfoPath xml file in SharePoint Library

If you try to update the InfoPath xml file through object model in events/WebParts or through any medium.

While execting the Item.Update() will cause the below error. While updating the InfoPath xml file in ListItem the file and ListItem object getting disconnected.

Item.File.Update() will solve your issue.

StackTrace […]

Error when submitting InfoPath form SharePoint Services form library (InfoPath cannot connect to the data source)

Using the RegForm Tool to Create a Fully Trusted Form

Use the Below Syntax to Register form in the Server as Fully Trusted

RegForm /U urn:MyForm:MyCompany /T Yes C:MyFormsMyTrustedForm.xsn

If the Form is Fully Trusted then it will have the access to connect to other data sources such as SQL.

Creating & Publishing InfoPath Form using Form Services in Moss 2007

This Article will help you to create and publish the InfoPath Form into Form Services in MOSS 2007.

Form Services in MOSS 2007 Form Services is a New and Great Feature introduced in MOSS 2007, using the form services the InfoPath form Templates will be uploaded to the Form Library and the Users can able […]