SPMetal and SharePoint's OOTB Blog Site Template
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.开发者_如何学Go 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!
精彩评论