views:

165

answers:

3

I have a SharePoint site that's being created from a custom site definition. The site definition has the following Features:

  1. A custom content type.
  2. A custom list template whose schema.xml file refers to that content type.
  3. A list instance feature which refers to my above list template feature.

During the site provisioning process, I activate each of these features (each is at the SPWeb level) through C# code in the order above. My resulting site looks as I expect and seems to work fine, but it has the weird artifact that the "all site content" page for my site shows my custom list twice.

My list acts okay -- its item receivers fire correctly and only once. In SharePoint Manager (SPM), I also see the list show up twice, and when I expand the tree to look at the attributes, they appear identical across the two lists (even the list items inside the lists). I suspect that I may be fooling myself and SPM might be just looking at the same list twice, while some actual rogue list lies in the dark shadows of my site.

So, what could have gone wrong here? How could I have created multiple lists of the same name? How can I correctly create this list? And how can I properly clean up the weirdness in existing sites that exhibit this behavior?


Edit: In response to Michael Stum's question, I created this console app to loop through the site's lists and get the ID:

using (SPSite site = new SPSite("http://myserver/projects/myproject"))
{
    using (SPWeb web = site.OpenWeb())
    {
        var lists = web.Lists;
        foreach (SPList list in lists)
        {
            Console.WriteLine(list.ID + ": " + list.Title);
        }
    }
}

This code shows my list twice -- same title, same ID.


Another edit: I looked in the SharePoint content database for this site, and I executed this query:

SELECT * FROM AllLists where tp_webid = '<my SPWeb guid>'

This reveals that there's only one actual list with the title and GUID that I retrieved from my C# code above. So what is causing these multiple entries to show up when I'm browsing through my site?

A: 

Have you tried with:

list.RootFolder.Name

(which shows the "internal" name - a part of the url)

list.Title shows the displayname (which can appear twice or more).

This could also be the explanation why you get multiple lists. You have maybe added them with the same displayname but dirrerent "internal" names?

Johan Leino
Thanks for the suggestion. No luck. Both the entries look identical in this way, too.
Chris Farmer
That is super weird...never seen anything like that
Johan Leino
+2  A: 

I suggest you put a call in to Microsoft, this sounds like a bug.

P.S. without seeing the actual solution that creates the list we can't determine what's happening, perhaps a feature got activated twice...

Colin
A: 

I know it's been awhile but did you ever find a resolution? I have a similar situation where I create a list from a content type/list definition feature, two show up.

SPD 2007 only "sees" one list.

Thanks.

Shawn