Updating InfoPath promoted column in MOSS from Workflow/Application Page

11 03 2009

This is something I have been having problems with for ages and thanks to Chris Jones I have now found the solution.

If you try to update the value of an InfoPath promoted column within MOSS (from a workflow/application page or other) you will notice that the item[“fieldname”] = “Something” method does not work.

This method works fine for normal SharePoint columns but when it comes to InfoPath promoted fields/columns, it simply will not update the column at all.

Chris has posted some code on his blog which I can confirm updates the column within MOSS and on the form itself, it basically opens the xml document, navigates to the particular data to update and then saves the document back to SharePoint.

Chris modified this code from a forum post but could not find the original author so thanks to them too!

You will need to pass in the XPath of the field you wish to update and the URN of your form.

See Chris’s code here:

http://www.qualitysharepoint.com/2009/03/update-infopath-form-from-workflow.html

In addition to the code on his blog you will need the following code showing how ‘_settings’ and ‘_incidentInfoDoc’ are loaded:

**CODE**

_settings.NamespacePrefix = “my” //

_settings.Namespace = “http://schemas.microsoft.com/office/infopath/2003/myXSD/2008-09-22T20:08:03”

And _incidentInfoDoc is loaded like this

SPFile file = _workflowProperties.Item.File;

using (var streamReader = new StreamReader(file.OpenBinaryStream()))

{

string content = streamReader.ReadToEnd();

_incidentInfoDoc = new XmlDocument();

_incidentInfoDoc.LoadXml(content);

}

**CODE**

Cheers Chris!

Advertisements

Actions

Information

One response

11 11 2009
Infopath – Promoted Fields In Sharepoint « Sladescross's Blog

[…] Infopath – Promoted Fields In Sharepoint Filed under: Infopath, Promoted, Sharepoint — sladescross @ 1:39 pm https://sharepointcoding.wordpress.com/2009/03/11/updating-infopath-promoted-column-in-moss-from-work… […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: