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 XmlDocument = new(); 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 derogatam per SharePoint system" Error autem in Adaequationis InfoPath xml file SharePoint library

Si velis ut update InfoPath xml file, quod per exemplum in rerum / aut per aliquod medium Webparts.

While the execting Item.Update() sequitur error faciam. While updating the InfoPath xml file in ListItem the file and ListItem object getting disconnected.

Item.File.Update() solvere te egredientur.

StackTrace […]