1

I'm attempting to create some workflows and webparts to work with out of the box blog templates in a site collection. I used SPMetal against a normal blog site to generate the LINQ classes and contexts and while coding I noticed that the Categories list didn't have a class generated. I figure that's ok... since everything's a list in SharePoint I could just specify the list as a generic item list (Categories only has a Title, ModifiedBy, etc listed on the list settings). This errors out when I attempt to query the list saying the list isn't a content type of item.

So... bummer there. I figure maybe there's something wrong with the default parameters with SPMetal. I create an configuration file to run with the SPMetal...

<?xml version="1.0" encoding="utf-8"?>
<Web AccessModifier="Internal" xmlns="http://schemas.microsoft.com/SharePoint2009/spmetal">
 <List Name="Categories">
  <ContentType Name="Item" Class="Categories" />
 </List>
</Web>

which gives me an error at the command line saying "Error: List Categories cannot be included because it does not contain a content type that derives from the Item content type. Now I'm kind of in a state where I'm wondering what the hell is going on under the sheets here... I checked the Schema.xml for the Categories List in the Blog Site Template and compared that to the Posts List Schema.xml... Posts has:

<ContentTypes>
 <ContentTypeRef ID="0x0110" />
</ContentTypes>

and Categories does not have even have a ContentTypes node in it at all. So I am a bit tempted to just modify the schema for categories and put that node in there specifying the ID="0x01" to force it. Otherwise I'm open to advice if anyone else has experience this problem.

Thanks!

intlfctb
  • 11
  • 1
  • Does the categories list exist in the root site or a subsite? I had a similar issues where lists where not showing up in my LINQ class and once I used SPMetal against the subsite instead of the root the appropriate objects were created. – Matt Klepeis Aug 24 '11 at 07:22

0 Answers0