Solved

How do I execute InfoPath Submit Data Connection from c#

Posted on 2013-12-16
4
1,037 Views
Last Modified: 2013-12-16
I currently have four different Submit Data Connections that are implemented as Rules behind a button.

I need to execute them two different ways:
-Code behind
-Separate process, code called by a timer.



Thank in advance,
SDC00.png
SDC01.png
SDC02.png
SDC03.png
0
Comment
Question by:rezlab
  • 2
  • 2
4 Comments
 
LVL 28

Expert Comment

by:clayfox
ID: 39721959
This post has some sample code that might be helpful.

http://www.infopathdev.com/forums/p/11836/41621.aspx#41621
0
 

Author Comment

by:rezlab
ID: 39722066
Thanks. Not quite. I am looking for something along the lines of
DataConnection fsc = DataConnections["NameOfDataConnection"];
fsc.Execute();

But I am unsure if I need to pass in parameters as noted in the images and if so how does one do that?

The other questions is can all of this be done away from InfoPath in a stand alone process?
0
 
LVL 28

Accepted Solution

by:
clayfox earned 500 total points
ID: 39722125
It looks like you already have the web service fields pointed at the fields in the form schema.
Those would need to have the appropriate values set before submit, regardless of whether via code or via rules.

You can specify a specific submit date connection via code.

Unless you are just submitting the whole xml file, there would not be a way to submit it external to InfoPath.

If your process cannot be completed during the initial user session, then possibly some workflow or an admin form which would query form data from a SP list or something and then submit in bulk or whatever are other options.
0
 

Author Comment

by:rezlab
ID: 39722147
I ended up with:

WebServiceConnection wsc = (WebServiceConnection)DataConnections["Submit to Database"];
 wsc.Execute();

I guess for the second half I will just have to parse the XML and call the web services like normal, I was just hoping for a short cut.

Thanks
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note:  There are two main ways to deploy InfoPath forms:  Server-side and directly through the SharePoint site.  Deploying a server-side InfoPath form means the form is approved by the Administrator, thus allowing greater functionality in the form. …
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now