Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Thanks for the sample code, @axel_c and @Jeff Burt</p> <p>Below is just the same code from Jeff Burt modified for a file in Document set which I needed. If you don't already have the Document Set reference, you can check out this site on how to grab one: <a href="http://howtosharepoint.blogspot.com/2010/12/programmatically-create-document-set.html" rel="nofollow">http://howtosharepoint.blogspot.com/2010/12/programmatically-create-document-set.html</a></p> <p>Also, the codes will open the .xml version of the infopath form and not the .xsn template version which you might run into.</p> <p>Thanks again everyone...</p> <pre><code> private void ChangeFields(DocumentSet docSet) { string extension = ""; SPFolder documentsetFolder = docSet.Folder; foreach (SPFile file in documentsetFolder.Files) { extension = Path.GetExtension(file.Name); if (extension != ".xml") //check if it's a valid xml file return; XmlDocument xml = new XmlDocument(); //Open XML file and load it into XML document, needs to be .xml file not .xsn using (Stream s = file.OpenBinaryStream()) { xml.Load(s); } //Do your stuff with xml here. This is just an example of setting a boolean field to false. XmlNodeList nodes = xml.GetElementsByTagName("my:fieldtagname"); foreach (XmlNode node in nodes) { node.InnerText = "xyz"; } //Get binary data for new XML byte[] xmlData = System.Text.Encoding.UTF8.GetBytes(xml.OuterXml); using (MemoryStream ms = new MemoryStream(xmlData)) { //Write data to SharePoint XML file file.SaveBinary(ms); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload