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”; […]

"Berkas telah dimodifikasi oleh sistem SHAREPOINT " Error saat InfoPath Memperbarui file xml di SharePoint Perpustakaan

Jika Anda mencoba untuk memperbarui file xml InfoPath melalui model objek dalam acara / webparts atau melalui media apapun.

Sementara execting Item.Update yang() akan menyebabkan kesalahan di bawah ini. Sementara memperbarui file InfoPath xml di ListItem file dan objek ListItem mendapatkan terputus.

Item.File.Update() akan memecahkan masalah Anda.

StackTrace […]