How to get the URL to an InfoPath content type?
Hi,
I face the following problem: I created an InfoPath form which is the template for a list on a SharePoint server. This InfoPath form is installed as acontent type. Now, when -from the code of a web service- I want to access the path to the file
http://sharepointserver/MyDocumentLibrary/Forms/template.xml
which is not what I want, of course.
Here's the code I wrote:
SPList
sharePointList = web.GetList (string.Format ("{0}{1}/",System.Configuration.ConfigurationManager.AppSettings["SPSiteURL"],
listName ) );
// The full path to the XSN file
string xsnPath =default (string );
// Get the document content types for the current list item
if ( sharePointList.ContentTypes !=null && sharePointList.ContentTypes.Count > 0 )
{
// If the list item has a content type, find
// the path to the document template for this list
SPContentType contentType = sharePointList.ContentTypes[0];
if ( contentType !=null )
{
xsnPath =string.Format ("{0}?noredirect=true",
contentType.DocumentTemplateUrl );
}
}
...
So, what I want to know is whether there is a way to get the correct path to the InfoPath template. I am sure there is a mean to accomplish this, as sometimes SharePoint itself returns the correct path, but I would like to know the correct approach.
Thanks a lot,
Zsolt

