how to update infopath form library item field programatically ? - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

how to update infopath form library item field programatically ?

Last post 09-15-2010 11:02 PM by nikhilvaghela. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 09-15-2010 11:02 PM

    how to update infopath form library item field programatically ?

    Hi,

    I was successfully able to update one of teh fields (which was of type boolean) from infopath for library item  using sharepoint object Model as if it was a list item.

    But for another field which is of type string , the same code just gets executed but does not change the field value !!!!

    I am using following code, which works for that boolean field but for another field of type string , not sure why it is not workign. Any idea ?

    SPSecurity.RunWithElevatedPrivileges(delegate()

    {

    SPWeb web;

    SPSite site = new SPSite("http://sharepointsite");

    web = site.OpenWeb();

    SPList formLibList = web.Lists["FormLibraryName"];

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

    web.Site.WebApplication.FormDigestSettings.Enabled = false;

    web.AllowUnsafeUpdates = true;

    SPListItemCollection col = formLibList.GetItems(query);

    if (col.Count > 0)

    {

    col[0][
    "CustomerName"] = "test customer name";

    col[0].Update();

    }

    web.Site.WebApplication.FormDigestSettings.Enabled =
    true; web.AllowUnsafeUpdates = false;

    });

    Thanks,

    Nikhil

     

     

     

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