Neðan línur bút númer er að uppfæra InfoPath xml skrá(skrá)
SPList _list = _web.Lists[“SampleFormLib”];
MemoryStream myInStream = new MemoryStream(item.File.OpenBinary());
XmlTextReader lesandi = new XmlTextReader(myInStream);
XmlDocument læknir = new XmlDocument();
doc.Load(lesandi);
reader.Close();
myInStream.Close();
XmlNamespaceManager nameSpaceManager = new XmlNamespaceManager(doc.NameTable);
nameSpaceManager.AddNamespace(“minn”, “http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-06-11T12:44:57“);
doc.DocumentElement.SelectSingleNode(“minn:Status”, nameSpaceManager).Inner Text = “Vistað”;
doc.DocumentElement.SelectSingleNode(“minn:SaveDate”, nameSpaceManager).InnerText = DateTime.Today.ToString();
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
SPFile newFile = _web.Folders[“SampleFormLib”].Files.Add(item.File.Name.ToString(), (encoding.GetBytes(doc.OuterXml)), satt);
item.File.Update();
Make sure you execute item.File.Update() to commit the changes (I got the errors while execute item.Update() and spent couple of hours to find 🙁 )
Have you considered adding some differing opinions to your article? I think it might enhance viewers understanding.