Form submiting using c# code. - InfoPath Dev
in

InfoPath Dev

Form submiting using c# code.

Last post 07-26-2006 07:05 AM by shekar. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 06-25-2006 10:59 PM

    Form submiting using c# code.

    Hi,
    Please help me out...
    I have to submit InfoPath form to Sharepoint form library by using the c# code.
    I written the code in button click event.This is my code...


    string sSharePointFolder = "http://sharepoint-srv.lgcnsglobal.com/sites/IQA/Quality%20Auditing%20Forms/form.xml";
    DAVAdapter oSharePoint = (DAVAdapter)thisXDocument.DataAdapters["SharepointSubmit"];
    oSharePoint.FolderURL = sSharePointFolder;
    oSharePoint.Submit();


    but when submiting the form i am getting this error.

    System.Runtime.InteropServices.COMException
    An item with the following index does not exist in the collection: SharepointSubmit
    at Microsoft.Office.Interop.InfoPath.SemiTrust.DataAdapters.get_Item(Object varIndex)
    at Microsoft.Office.Interop.InfoPath.SemiTrust.DataAdaptersCollectionWrapper.get_Item(Object varIndex)
    at Quality.Quality.btnSubmit_OnClick(DocActionEvent e) in c:\iqa\quality\formcode.cs:line 86
    at Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_SinkHelper.OnClick(DocActionEvent pEvent)


    Please help to solve this. I am new to use this InfoPath and SharePoint.

    Thanks in advance.
  • 06-26-2006 04:50 AM In reply to

    Re: Form submiting using c# code.

    Hi

    You need to pass SharePoint file name to your code.To pass Share point file name,add this line to your code 'osharePoint.FileName= fileName;'.
    Madhuri
    http://www.ggktech.com
  • 07-26-2006 07:05 AM In reply to

    • shekar
    • Not Ranked
      Male
    • Joined on 07-26-2006
    • India
    • Posts 22

    Re: Form submiting using c# code.

    Hi
    Create a data connection with name as "SharepointSubmit" and you specify the filename there only at the time of connection and set
    string sSharePointFolder = "http://sharepoint-srv.lgcnsglobal.com/sites/IQA/Quality%20Auditing%20Forms";
    and rest of the code is same as you wrote.
    Shekar
    http://www.ggktech.com
Page 1 of 1 (3 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.