Programmatically retrieve a form template from a SharePoint library
So an InfoPath form is deployed to a SharePoint server. It gets deployed through central admin and then activated to a particular site collection. This site collection has a forms library with the appropriate content type for the activated InfoPath form.
Using the object model, how can I retrieve the form template back out of SharePoint programmatically. I know the url to the web, name o开发者_JAVA百科f the list and the name of the form itself.
Found an answer myself that I'll post here for anyone else with the question:
using (SPSite site = new SPSite(siteUrl))
{
using (SPWeb web = site.RootWeb)
{
SPList destinationList = web.Lists[listName];
string formUrl = destinationList.ContentTypes[formName].DocumentTemplateUrl;
}
}
精彩评论