Andreas Lindahl

Hi

I'm creating a custom list template as a feature. The problem is that SharePoint can't seem to find my schema.xml for the list. In all examples I have found, the schema.xml file is always placed in a folder directly below the feature folder, with a name identical to the name of the list (as specified in the ListTemplate element). That won't work for me, however. The schema.xml for my list can be found at [featurename]\ListTemplates\[listname]\schema.xml. I have several list templates in my feature and want to organize them in a ListTemplate folder in my feature directory. But that means that SharePoint can't find the files, it seems. Everything works if I place the folder containing my list template schema.xml directly in my feature folder, however. Is it possible to solve this problem The SDK mentions a Path attribute in the ListTemplate element which can be used to specify an alternative path to the schema.xml, but doesn't really mention what the path should look like...

The error I get looks like this, by the way:

Exception from HRESULT: 0x81070201 at Microsoft.SharePoint.Library.SPRequestInternalClass.CreateListFromFormPost(String bstrUrl, String& pbstrGuid, String& pbstrNextUrl)
at Microsoft.SharePoint.Library.SPRequest.CreateListFromFormPost(String bstrUrl, String& pbstrGuid, String& pbstrNextUrl)



Re: SharePoint - Development and Programming Problem with list templates and features

techietex

Hi

I'm getting similar excpetion. Were you able to solve this If so, could you please post the solution.

Thanks in advance.





Re: SharePoint - Development and Programming Problem with list templates and features

andrewpa

Yes, set your Path attribute to be the folder paths containing the folder that has the list name and that contains schema.xml. Almost all of the feature element XML elements have context from the root of the Feature folder under the 12 hive.

So if your list schema is situated like this:

CoolestFeatureEver\ListTemplates\listone\schema.xml

Your path attribute in your ListTemplate that is in the CoolestFeatureEver Feature is Path="ListTemplates".





Re: SharePoint - Development and Programming Problem with list templates and features

techietex

Thanks for the quick reply.

Did you mean this: <ElementManifest Location="ListTemplate\Contacts.xml" />

I'm doing this already. Please let me know. Thanks again!





Re: SharePoint - Development and Programming Problem with list templates and features

andrewpa

So in this case your Contacts.XML is the file that contains a <ListTemplate> sequence If so,

then I will assume your list is defined in a schema.XML under a directory with the same exact name as is defined in the <ListTemplate>. Remember list template behave the same way whether in ONET proper or here in Features. The XML file introducing the list assumes there is a directory with the same name as the list name.

So list templates always have this basic setup on disk:

12 Hive Folders\

FeatureFolder\

Feature.XML

Contacts.XML

\listNameFolder [same name as defined in above Contacts.XML]

schema.xml

With this setup you can see that you have nothing special to setup to get anywhere because there are no extra folders between your list template file (Contacts.XML) and the folder and schema.XML file it is looking for. Only when you introduce another extra layer between them do you need to add that path information to the Path attribute in your ListTemplate.





Re: SharePoint - Development and Programming Problem with list templates and features

Andreas Lindahl

Still haven't found a solution to my problem. I still get the same error message, no matter what I set the Path attribute to, and when I view the logs I find this:

Failed to retrieve the list schema for feature [FeatureGUID], list template 20005; expected to find it at: "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Features\[FeatureName]\[ListName]"

Seems like it always thinks the list schema file is located in the root of the feature in a folder with the same name as the actual list, completely ignoring the Path attribute.

My list schema.xml file is located at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Template\Features\[FeatureName]\ListTemplates\[ListName] and I therefore tried setting Path to ListTemplates. Didn't work.

I really don't want to place all of my list templates in folders directly below the feature folder, but rather in a ListTemplates sub folder...

I THINK I read somewhere that the Path attribute is deprecated. Is this true, and if so - what should I use instead

*sigh*





Re: SharePoint - Development and Programming Problem with list templates and features

techietex

I got it working. In my case, I had to name the folder that contained Schema.xml with the same name I used for "Name" attribute in element manifest xml file.





Re: SharePoint - Development and Programming Problem with list templates and features

Andreas Lindahl

Still haven't found a solution to my problem... Doesn't seem to be possible to place your schema.xml files in a folder that isn't located directly below your feature folder.