Programatically create/open a infopath form from Existing Template in C# - InfoPath Dev
in

InfoPath Dev

Programatically create/open a infopath form from Existing Template in C#

Last post 07-16-2019 11:16 AM by foldwide. 14 replies.
Page 1 of 1 (15 items)
Sort Posts: Previous Next
  • 02-06-2009 04:05 PM

    Programatically create/open a infopath form from Existing Template in C#

    Hi,

    I am new to InfoPath Development.

    As per my project requirement, upon clicking a button in .NET application, i need to create a new infopath form. I have the InfoPath template with me and it is fully trusted.

    How can i create/open an infopath form based on my template by programatically in C#.

    Is there any API for InfoPath like MS-Word. I know how to open/create a new word document using Word API.

    And one more, my project is a pure .NET windows application and is not using any web services, share point server,....

    Can you please please help me.

    Thanks in Advance,

    Regards,

    Kavitha.

  • 02-18-2009 03:45 AM In reply to

    Re: Programatically create/open a infopath form from Existing Template in C#

    Hello kavitha..

    check out this article..

    http://www.bizsupportonline.net/infopath2007/programmatically-create-infopath-form-console-app.htm

    In the article..he is picking up the template from WSS library...you need to change it to like picking up the template from local server ...hope this helps 

     

     

  • 02-18-2009 02:17 PM In reply to

    Re: Programatically create/open a infopath form from Existing Template in C#

    Hello,

    Thanks for your reply. It has helped me a lot in creating an infopath form programatically.

     Here is the code i have created:

    using InfoPath = Microsoft.Office.Interop.InfoPath; 

    InfoPath.
    ApplicationClass infoPathClass = new Microsoft.Office.Interop.InfoPath.ApplicationClass();

    InfoPath.XDocument xDoc = infoPathClass._Application_XDocuments.NewFromSolution(<Path of the Template(.xsn) file>);

    xDoc.SaveAs(@"C:\Sample.xml");

    After the above steps, the "Sample.xml" file has created in the specified path.

     Regards,

    Kavitha

  • 02-19-2009 01:27 AM In reply to

    Re: Programatically create/open a infopath form from Existing Template in C#

    Hello

    Nice to know your job is done.

    Actually my task is also so similar but the file must be saved in .PDF format. Can you please help me? Thanks 

     

  • 07-16-2019 08:29 AM In reply to

    Re: Programatically create/open a infopath form from Existing Template in C#

    Hi Does anyone still have the code from the article http://www.bizsupportonline.net/infopath2007/programmatically-create-infopath-form-console-app.htm I used it before, however, I somehow lost the code and won't able to make changes to it. The site somehow doesn't seem accessible now. Thanks
  • 07-16-2019 08:50 AM In reply to

    Re: Programatically create/open a infopath form from Existing Template in C#

    Internet Archive Wayback machine to the rescue: https://web.archive.org/web/20150227063232/http://www.bizsupportonline.net/infopath2007/programmatically-create-infopath-form-console-app.htm
    Hilary Stoupa

  • 07-16-2019 09:07 AM In reply to

    Re: Programatically create/open a infopath form from Existing Template in C#

    Thanks. There is actually another program that will create InfoPath file from CSV and push that file to SharePoint. Do you happen to have the code for that program as well?
  • 07-16-2019 09:14 AM In reply to

    Re: Programatically create/open a infopath form from Existing Template in C#

    No - was it on the same site? I did find this with a simple web search: https://archive.codeplex.com/?p=csvtoinfopath
    Hilary Stoupa

  • 07-16-2019 09:35 AM In reply to

    Re: Programatically create/open a infopath form from Existing Template in C#

    May be not. I guess I probably got it from somewhere. What I need to do is to read from Excel/csv file, then create an InfoPath file from each row and upload the files to SharePoint Document Library. Any suggestion on how to do this? Thanks
  • 07-16-2019 09:43 AM In reply to

    Re: Programatically create/open a infopath form from Existing Template in C#

    Did you look at the link in my last post? It looks like it does that.
    Hilary Stoupa

  • 07-16-2019 10:25 AM In reply to

    Re: Programatically create/open a infopath form from Existing Template in C#

    You are right, I think that's the tool I used before. However, the download doesn't seem to work anymore.
  • 07-16-2019 10:35 AM In reply to

    Re: Programatically create/open a infopath form from Existing Template in C#

    Not sure if you mean the tool no longer works, or that you weren't able to download it? Attaching, just in case it is the latter.
    Hilary Stoupa

  • 07-16-2019 10:46 AM In reply to

    Re: Programatically create/open a infopath form from Existing Template in C#

    I did download the same file. May be I don't know how to use it, I don't see the source code.
  • 07-16-2019 11:09 AM In reply to

    Re: Programatically create/open a infopath form from Existing Template in C#

    Yuck you are right - sorry, I didn't open the folder. How about just using PowerShell to create them and then uploading them to SharePoint? You just need to know the XML structure and then add the InfoPath processing instructions that you can get from the template.xml if you save your form as source files. Here's one sample I found online for creating XML from Excel - I'm sure there are others. https://gallery.technet.microsoft.com/scriptcenter/fcf0cfc5-3523-4563-88d5-0a0c3f7f3572
    Hilary Stoupa

  • 07-16-2019 11:16 AM In reply to

    Re: Programatically create/open a infopath form from Existing Template in C#

    Thanks. Let me try that. My kid lost my drive that has the code in it and I was hoping I can just find it in case I need to modify it. Luckily I still have the exe file that I created I can use for now. Hopefully there is no requirement change anytime soon. Thanks
Page 1 of 1 (15 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.