Out Of The Box Sharepoint (?)

December 1, 2011

Infopath-fields and custom list-columns

Filed under: Uncategorized — Peter Kruisman @ 11:22 am

I blogged before about Infopath-fields and custom list-columns values from a workflow. It proved to be even more challenging and resulted in a code behind solution. As noted before you can retrieve the ID of the form using a dataconnection:
– Formcode.cs
FormEvents_Loading()
XPathNavigator secunDD = DataSources[“ItemID”].CreateNavigator();
XPathNavigator ID = secunDD.SelectSingleNode(“/dfs:myFields/dfs:dataFields/dfs:DUF/@Id”, NamespaceManager);

I pass this ID to an other class referencing Microsoft.SharePoint. With SPLIST SPITEM and CAML I got hold of the field values
SPLIST:
– SPList splijst = web.Lists[“ListName”];
CAML:
– Squery = string.Format(“<Where><Eq><FieldRef Name=’ID’ /><Value Type=’Counter’>{0}</Value></Eq></Where>”, ID);
SPITEM:
– spcollectieItems = splijst.GetItems(query);
– item = spcollectieItems[0];
– VariableToReturnToFormcodeCS = ( item["FieldName"] == null)? "" : item["FieldName"].ToString();

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

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

Blog at WordPress.com.

%d bloggers like this: