Update Sharepoint document library column from Infopath form. - InfoPath Dev
in

InfoPath Dev

Update Sharepoint document library column from Infopath form.

Last post 11-18-2010 02:28 AM by Samson. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 02-28-2010 06:03 PM

    • Aditya
    • Top 200 Contributor
      Female
    • Joined on 01-26-2010
    • Sydney
    • Posts 59

    Update Sharepoint document library column from Infopath form.

    Hi,

    Is there a way to update a column in sharepoint document library  from secondary dataconnection using code in Infopath on some button click.

    Thanks. 

    Aditya,
    .Net programmer.
  • 02-28-2010 10:25 PM In reply to

    Re: Update Sharepoint document library column from Infopath form.

    you will need to either write code for that or use qrules .

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 03-01-2010 05:22 PM In reply to

    • Aditya
    • Top 200 Contributor
      Female
    • Joined on 01-26-2010
    • Sydney
    • Posts 59

    Re: Update Sharepoint document library column from Infopath form.

    Can u help me writing code for this. Thanks. 

    Aditya,
    .Net programmer.
  • 03-01-2010 10:19 PM In reply to

    Re: Update Sharepoint document library column from Infopath form.

    hi Aditya,

    i hope you know object model code, how to update share point list and all that, use the same concept.

    String listName = null;

    int index;

    string path = "your sharepoint path";

    SPSite thisSite = null;

    SPWeb thisWeb = null;

    SPList thisList = "list name";

    SPListItem item = null;

    XPathNavigator xnDoc = null;

    XPathNavigator xnFormName = null;

    try

    {

    xnDoc =
    this.MainDataSource.CreateNavigator();

    thisSite = new SPSite(path);

    thisWeb = thisSite.OpenWeb();

    thisList = thisWeb.Lists[listName];

    //index needs to be retrieved from the secondary data connection 

    item = thisList.GetItemById(index);

    thisWeb.AllowUnsafeUpdates = true;

    item["your column name"] = "value";

    item.Update();

    }

    catch (Exception ex)

    {

    }

    finally

    {

    item =
    null;

    thisList = null;

    if (thisWeb != null)

    thisWeb.Dispose();

    if (thisSite != null)

    thisSite.Dispose();

    }

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 11-18-2010 02:28 AM In reply to

    • Samson
    • Not Ranked
    • Joined on 12-03-2008
    • Posts 2

    Re: Update Sharepoint document library column from Infopath form.

    Hi Qazi,

    Can you please tell me how to get the index of the Item from the list.

     

    Thanx in advance. :)

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