jump to navigation

Change location secondary DataSource for InfoPath browser-based May 13, 2008

Posted by spunkyvt in Programming, Sharepoint.
Tags: , , ,
add a comment

The title is a little misleading, because we are not actually changing the datasource.

In the FormEvents_Loading method put this code

String titleName = e.InputParameters["XmlLocation"].Substring(e.InputParameters["XmlLocation"].LastIndexOf(“/”)+1);

using (SPSite site = new SPSite(_baseURL))
{

using (SPWeb web = site.OpenWeb())
{
SPList ls = web.Lists[_FormName];

SPQuery query = new SPQuery();
query.Query = “<Where><Eq><FieldRef Name=’Title’/><Value Type=’Text’>” + titleName + “</Value></Eq></Where>”;

SPListItemCollection its = ls.GetItems(query);

string h = its[0]["ColumnName"].ToString() ;

}
}