Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / August 2007

Tip: Looking for answers? Try searching our database.

Publishing an InfoPath

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sadhana - 09 Aug 2007 13:40 GMT
Hi,
Is it possible to publish an InfoPath's data programmatically?
My task is that, I have some checkboxes and corresponding file
attachments(infopaths). when a user selects a checkbox and clicks on a
button, that file attachement (infopath) should be published to sharepoint
server document library.
Can we do it programmatically?

Thanks in advance
Sadhana
SSA - 09 Aug 2007 14:26 GMT
Just publish the form programmatically and everything in the form will
automatically be submitted. You may use the following code to submit:

public void FormEvents_Submit(object sender, SubmitEventArgs e)
       {
           
           FileSubmitConnection fc =
(FileSubmitConnection)this.DataConnections["Main submit"];
           // Modify the URL we want to submit to by concatenating the
           string dLocation = this.Location.ToString();
           fc.FolderUrl = dLocation.Substring(0, dLocation.LastIndexOf("/"));

           // Execute the submit connection
           try
           {

               fc.Execute();

               e.CancelableArgs.Cancel = false;

           }

           catch (Exception ex)
           {

               e.CancelableArgs.Cancel = true;
           }

Location is a local variable. You can skip it and use the following line
instead:

string dLocation = "http://server/dolib/forms/AllItems.aspx"; --> This is
just a sample, use the exact complete library URL here and you can also
capture the url programmatically. For example,

dLocation = this.Template.Uri.ToString();

Hope this helps

SSA
MOSS MVP

> Hi,
> Is it possible to publish an InfoPath's data programmatically?
[quoted text clipped - 6 lines]
> Thanks in advance
> Sadhana
sadhana - 15 Aug 2007 16:26 GMT
Hi,

What is this "Main Submit" in Data Connections?
Is it a dataconnection library in sharepoint server or just a dataconnection
to submit data? even, I tried it in both cases, it is not working.
and what is this "Location" in the program. I have given the URL directly at
the dlocation.

How to proceed after this?

Thanks

> Just publish the form programmatically and everything in the form will
> automatically be submitted. You may use the following code to submit:
[quoted text clipped - 48 lines]
> > Thanks in advance
> > Sadhana
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.