InfoPath xml update from SharePoint Workflow - InfoPath Dev
in

InfoPath Dev

InfoPath xml update from SharePoint Workflow

Last post 01-27-2017 11:28 AM by Hilary Stoupa. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 01-27-2017 09:12 AM

    InfoPath xml update from SharePoint Workflow

    Ok,

    I may be getting some terminology here wrong, so please bare with me. I have a form that has been in use for several years around the office. It is an infopath browser form, that integrates into our SharePoint 2010 environment. It's mainly a sign off form, but as management has requested to track new things, I've added new fields into the form to accommodate their requests.

    I also have workflows on the library to handle various tasks, or send various alerts, but one thing I've noticed is that the xml in the doc library has only the fields that were available in the doc at the time it was last saved. That's logical enough to me - how could it possibly have what it didn't know about. It's not until I open the form and it reloads and I make a save that the any fields added in the interim to the infopath xsn file, are added to the form. I'm not sure what the overall node structure is called (schema?).

    My question is, is there some way to force this update from SharePoint programmatically? As a test, I tried using XMLDocument to open a file, toggle one field to false, and write that data back to the file (code attached), but item.File.OpenBinaryStream() does not apparently pull in the new fields as opening the file through the browser does. Does anyone have any thoughts here on how I might achieve what I'm hoping for?

    Thanks in advance for any help you may be able to offer.

  • 01-27-2017 09:27 AM In reply to

    Re: InfoPath xml update from SharePoint Workflow

    You will not believe what I am about to tell you. :) If you open the library in Windows Explorer, select all the files and copy them (I just use CTRL A and CTRL C) then paste the copied files into a local folder (any old temp folder) - as the files paste locally, the promoted properties will update in SharePoint. Try it with just one or two & see. That way you don't end up having to reopen the files! Once they have all copied locally, you can just delete the local copies.
    Hilary Stoupa

  • 01-27-2017 09:58 AM In reply to

    Re: InfoPath xml update from SharePoint Workflow

    Thank you for your quick reply! Hmm, that did not seem to work for me (SharePoint 2010, explorer view for the library in question, ctrl-a, ctrl-c to local folder). I also tried grabbing one, copying it to the folder, and copying the folder version back to the library, but the property is still empty (screen shot attached). I tried from both a Windows 7 and a Windows XP machine, thinking maybe the version of Windows Explorer may be key to that.
  • 01-27-2017 11:07 AM In reply to

    Re: InfoPath xml update from SharePoint Workflow

    No, the version shouldn't matter, I've used this in Windows 7, Windows 10 and several different versions of Windows Server. In your screenshot, if you open one of those XML, does the promoted field update? EDITED TO ADD: Could it be that this is a new field and the old XML don't have a value?
    Hilary Stoupa

  • 01-27-2017 11:16 AM In reply to

    Re: InfoPath xml update from SharePoint Workflow

    re: your edit - that's correct. the xml on the file in the screen shot was saved before I had added field. So it will not get it until I open the form, then save it again. Is there a way to achieve this programmatically (powershell, c# workflow, etc) that you know of?
  • 01-27-2017 11:28 AM In reply to

    Re: InfoPath xml update from SharePoint Workflow

    Well, you could use PowerShell, sure - add the node & set the default value (looks like it has one). Easiest would be to copy the files locally, create an XSLT to update them, use PowerShell to transform & resave, then copy them back into the library.
    Hilary Stoupa

Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.