Conas Cuir InfoPath XML Comhad i Leabharlann Fóram Programmatically i SharePoint 2007

An thíos línte Blúire cód a thabhairt cothrom le dáta an xml infopath taifead(comhad)

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

MemoryStream myInStream = MemoryStream nua(item.File.OpenBinary());
Léitheoir XmlTextReader = XmlTextReader nua(myInStream);

XmlDocument doc = XmlDocument nua();
doc.Load(léitheoir);

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

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

doc.DocumentElement.SelectSingleNode(“mo:Stádas”, nameSpaceManager).Téacs Istigh = “Sábháilte”;
doc.DocumentElement.SelectSingleNode(“mo:SaveDate”, nameSpaceManager).InnerText = DateTime.Today.ToString();
System.Text.ASCIIEncoding ionchódú = System.Text.ASCIIEncoding nua();
SPFile newFile = _web.Folders[“SampleFormLib”].Files.Add(item.File.Name.ToString(), (encoding.GetBytes(doc.OuterXml)), fíor);
item.File.Update();

Bí cinnte a fhorghníomhú tú item.File.Update() iad chun na hathruithe (Fuair ​​mé an earráidí agus a fhorghníomhú item.Update() and spent couple of hours to find 🙁 )

1 trácht a Conas a Cuir XML Comhad InfoPath i Leabharlann Fóram programmatically i SharePoint 2007

Fág Freagra

Is féidir leat úsáid a bhaint na clibeanna HTML

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>