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 / January 2005

Tip: Looking for answers? Try searching our database.

Automate .xml Form Creation in VB.NET

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michael Reyeros - 28 Jan 2005 16:16 GMT
Can a .xml infopath form be created from an .xsn template file and
automatically saved to a document library all through vb.net code without
having to open InfoPath application???
Michelle Beall - 28 Jan 2005 17:05 GMT
Yes but not exactly.
If you need a user to enter data into the form then most definitely no.  The
user will need to have InfoPath to interact with the form and enter data.

The reason I say yes but not exactly is that you can (in theory) do the
following, but I haven't tried it:
(1) create the infopath form
(2) save a blank xml file by filling out the form but not entering any data.
(3) create a .NET application that uses the XML file generated as a
template.  Here you can manipulate the XML file just as you would any other
by setting node values
(4) Use Sharepoint's webservices to save the XML document to the document
library.

Hope that gives you some ideas.  Let me know if you get it working.

Michelle

> Can a .xml infopath form be created from an .xsn template file and
> automatically saved to a document library all through vb.net code without
> having to open InfoPath application???
Michael Reyeros - 28 Jan 2005 17:35 GMT
Well lets say I create the actual .xsm form template locally on my computer
then I upload it to the main forms library.  So the .xsn template exists.
All I want is to be able to create the empty xml file and have it stored in
another document library.

> Yes but not exactly.
> If you need a user to enter data into the form then most definitely no.
[quoted text clipped - 20 lines]
>> automatically saved to a document library all through vb.net code without
>> having to open InfoPath application???
Michelle Beall - 28 Jan 2005 18:03 GMT
The original problem you stated was you don't want to open InfoPath and you
want to store an empty xml file in another document library (possibly in a
different site or on a different server).  Maybe if you explain the context a
little it might shed a little more light on what/why you're trying to do.

When you publish the template the Sharepoint the xsn file is located in a
folder under the form library with the name "template.xsn" as follows:
<formlibrary>/forms/template.xsn.  When you "fill out the form" the xml
document is generated by InfoPath using the schema and the transformations in
the template.  So you either have to open the form in InfoPath and then
automate the saving and closing of the form or do something along the lines
of what I suggested before.  If you have any logic inside the infopath form
that needs to be run (such as in the onload) then you must open the template
using InfoPath.

You can open the InfoPath template to fill out the form without having to go
the form library.  Just add a hyperlink to your webpart/webform with the href
pointing to the complete URL of the template. (don't forget to add
/forms/template.xsn to the end of the form library url).  However, this still
opens InfoPath.

If you know the location of the document library and it is unchanging you
can set the save location in code in the form template.  Look at
thisXDocument.UI.SetSaveAsDialogLocation()
The following MSFT article may help you out a little:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_ip2003_ta/h
tml/odc_InfoPath_extending_save


> Well lets say I create the actual .xsm form template locally on my computer
> then I upload it to the main forms library.  So the .xsn template exists.
[quoted text clipped - 25 lines]
> >> automatically saved to a document library all through vb.net code without
> >> having to open InfoPath application???
Michael Reyeros - 28 Jan 2005 18:44 GMT
Ok, sorry for not explaining thoroughly what I am trying to do.

This is my situation.  I have a main document library that holds .xsn form
templates.  I also have subsites that each have their own document
libraries.  (Also just so you have a better understanding I am using a
custom interface of plain aspx pages, I am not using hte sharepoint
interface to access the sharepoint info.)

So What i have done is created a treeview of the documents that are in my
main document library that can be accessed from all other document
libraries.  The user can see the name of the documents in the treeview
control and can click on the document to open the file.  At the moment if th
user click on the filename the appropriate program is opened with the
current file ready for edit.  If it is an .xsn template file infopath is
opened and the user can fill out the form template and save to the current
library that they are in.  But what I want to do is if the user clicks on a
.xsn form template I want that before Infopath is opened for the application
to create the empty xml document with a specific name and save it to the
current document library and then open that newly created .xml document so
that the user can fill it out and simply hit save and have it save to
document library.

I hope that this is a better explanation then the one originally supplied.

> The original problem you stated was you don't want to open InfoPath and
> you
[quoted text clipped - 66 lines]
>> >> without
>> >> having to open InfoPath application???
Michelle Beall - 28 Jan 2005 19:39 GMT
ahhhh ... ok.  
Why the step of saving the blank xml in the document library?  Why can't the
user just have infopath open and enter data then click on save and have the
completed xml form saved?  That would make *your* task easier.

You can set the save location by using the SetSaveAsDialogLocation() I
mentioned earlier.  This sets the default save location.  You can also use
SetSaveAsDialogFileName() to set the default file name when the user clicks
on save.

What happens in your scenario if a user would click on the infopath template
to create a new document and then decide to abandon that document.  Maybe
they clicked on it by accident.

> Ok, sorry for not explaining thoroughly what I am trying to do.
>
[quoted text clipped - 90 lines]
> >> >> without
> >> >> having to open InfoPath application???
 
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.