Click here to Skip to main content
15,885,876 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hello, recently I've developed a web service that, when users enter specific info on a website, it calls the web-service which then loads a from template (that is published on a sharepoint lib) from the disc (I extracted the template.xml from the xsn file), then it populates the fields in the form based on user input, and uploads the form to a form library, all done programaticly. This is now working but I'm not satisfied with the process, or I think it can be done more elegantly.

What I would like to do, is to programaticly get the template.xml from the sharepoint library(when ever the form is updated i need to replace the old xml with the new one), now there are ways of doing this using external extractors wich I cannot use. Is there a fucntion or a .net library that does this or is there a better way of doing this, couse Im not shure if this is the best approach.

BTW I can get to the xsn file in the library.
C#
using (SPSite site = new SPSite(siteUrl)
{
    site.AllowUnsafeUpdates = true;
    using (SPWeb currWeb = site.OpenWeb())
    {
        list = currWeb.Lists[libraryName];
        SPXmlDocumentCollection collection = ContentTypes[formName].XmlDocuments;
        //do something with template
    }
}


Thanks for your answers!
B
Posted
Updated 27-Jan-13 3:17am
v3
Comments
AnandSharmaUK 28-Mar-13 5:47am    
I would use XPathNavigator objects while dealing with .xsn files

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900