SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to change the content of a field in a InfoPath form from a workflow in SharePoint. I have tried working with the "Update List Item" action but have been unable to to find a direct way of doing this.

share|improve this question

You can always download the xml of the InfoPath form using SPFile and have the workflow modify the contents of the xml file, thus modifying the item. To download the item try something like this

            using (var site = new SPSite(SPContext.Current.Site.Url))
                using (SPWeb web = site.OpenWeb())
                    #region download an intake form and parse into xml

                    //this code lets you download an intake form, parse its xml and save it 
                    SPFile file = web.GetFile(urlOfFile);
                    var sr = new StreamReader(file.OpenBinaryStream());
                    XDocument xdoc = XDocument.Parse(sr.ReadToEnd());
                    return xdoc;

                    #endregion download ...

Then once it's download, grab the XElement of the field you want to modify, and change the value. Then convert the XDocument back to a Stream and save it back to the SPFile using SPFile.SaveBinary() method then use SPFile.Update() to save your changes to the SPFile object.

share|improve this answer

Easiest way to do this is just promote the column from your InfoPath form so that SharePoint can see it (make sure you allow editing) then you can modify just like any other SharePoint list item (and no need to use any managed code).

I like Meyer's answer though if you are worried about users entering bad values from a datasheet or something and can deploy custom code in your environment.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.