Working with infopath forms in C#

M

Michael Reyeros

I was wondering if it was possible to get an existing form template and
create a blank xml form from this template. In other words take the .xsn
file and save its .xml data all through c# code?
 
M

Michael Reyeros

What I have done is created a library that will hold documents including
..xsn form templates. I also have managed to display this library in a
treeview control. This library will be used as the main document store for
my application. Users will have access to other document libraries in the
application and will be able to copy documents from this main document store
to the curent library that they are working in. So for instance if I am
working with document library A and I want to fill out one of the .xsn form
templates from the main document store I want the user to be able to click
on the name of the document from the treeview and have it save the empty
..xml form to the library that they are working in and then open that
document so that they can modify it and save it to that document library. I
hope that I have provided a good explanation as to what I am trying to
accomplish, and hope that it is not to difficult to understand.


"Greg Collins [InfoPath MVP]" <Greg.Collins_AT_InfoPathDev.com> wrote in
message A form template (.xsn file) does not contain a form (.xml form file). The
template is used to create a form. The form is saved separate from the
template.

What are you trying to accomplish?

--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com



I was wondering if it was possible to get an existing form template and
create a blank xml form from this template. In other words take the .xsn
file and save its .xml data all through c# code?
 
W

wjasonstrutz

Michael,

It looks like what you need is the NewFromSolution method. You call it from
an ExternalApplication object, and pass the URl to the template you want to
create. Search the MS site, or the Infopath help, for more information.

jason.
 
M

Michael Reyeros

Does anyone have any experience doing something like this or know of where I
can find some sample code showing how something like this or something
similar can be accomplished?



wjasonstrutz said:
Michael,

It looks like what you need is the NewFromSolution method. You call it
from
an ExternalApplication object, and pass the URl to the template you want
to
create. Search the MS site, or the Infopath help, for more information.

jason.

Michael Reyeros said:
What I have done is created a library that will hold documents including
..xsn form templates. I also have managed to display this library in a
treeview control. This library will be used as the main document store
for
my application. Users will have access to other document libraries in
the
application and will be able to copy documents from this main document
store
to the curent library that they are working in. So for instance if I am
working with document library A and I want to fill out one of the .xsn
form
templates from the main document store I want the user to be able to
click
on the name of the document from the treeview and have it save the empty
..xml form to the library that they are working in and then open that
document so that they can modify it and save it to that document library.
I
hope that I have provided a good explanation as to what I am trying to
accomplish, and hope that it is not to difficult to understand.


"Greg Collins [InfoPath MVP]" <Greg.Collins_AT_InfoPathDev.com> wrote in
message A form template (.xsn file) does not contain a form (.xml form file). The
template is used to create a form. The form is saved separate from the
template.

What are you trying to accomplish?

--
Greg Collins [InfoPath MVP]
Please visit: http://www.InfoPathDev.com



I was wondering if it was possible to get an existing form template and
create a blank xml form from this template. In other words take the .xsn
file and save its .xml data all through c# code?
 
M

michaelreyeros

Can anyone help me in accomplishing this? I just want to automatically
create the empty .xml form from the .xsn file and store it in another
document library.
 
B

Brian Teutsch [MSFT]

The empty XML file isn't difficult - just use InfoPath's NewFromSolution OM
method. I imagine like myself, most people on this newsgroup are going to be
unfamiliar with using C# to store a document into a SharePoint library. You
might be able to use InfoPath's SaveAs OM method with the URL for the
document/form library.

Brian
 
M

Michael Reyeros

Do you have code samples of how to do this??


Brian Teutsch said:
The empty XML file isn't difficult - just use InfoPath's NewFromSolution
OM method. I imagine like myself, most people on this newsgroup are going
to be unfamiliar with using C# to store a document into a SharePoint
library. You might be able to use InfoPath's SaveAs OM method with the URL
for the document/form library.

Brian
 
B

Brian Teutsch [MSFT]

Look in the developer's reference section of Help while you're designing a
form. That will have examples of the NewFromSolution method. There are
examples for SaveAs, too.

Brian
 
M

Michael Reyeros

But is it possible to accomplish this just using javascript on a regular
aspx page?? I just want to be able to do this without the user having to
interact much. I want it to just save the form in another document library
with one click of a button on a web form
 
B

Brian Teutsch [MSFT]

You'll get a lot more help with that from the SharePoint group. There is
little knowledge around here regarding how to get SharePoint to do something
like that (though someone might yet chime in).

Brian
 
B

Brian Teutsch [MSFT]

microsoft.public.sharepoint.portalserver is the newsgroup that I would start
with.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top