我有以下代码在内存中创建一个 XML 文件,对其进行更新,然后将其添加到表单库中。
// Creates a new XML document in memory
XmlDocument newCRF = new XmlDocument();
// Loads an existing XML file into that in-memory document
newXMLdoc.Load("Template.xml");
// Write the XML file to a document library
using (SPSite newSite = new SPSite("http://sharepoint/newsite"))
{
using (SPWeb newWeb = newSite.OpenWeb())
{
SPList newLibrary = newWeb.Lists["Test Library"];
byte[] xmlData = System.Text.Encoding.UTF8.GetBytes(newXMLdoc.OuterXml);
// Save file to form library
using (MemoryStream ms = new MemoryStream(xmlData))
{
SPFile newFileInLibrary = newLibrary.RootFolder.Files.Add("Filename.xml", ms);
}
}
}
如何访问“newFileInLibrary”对象,以便更改它的属性(例如“创建者”)?