SharePoint Internals – Hristo Pavlov’s Blog

16 September, 2008

The Id attribute of a ListInstance feature is ignored by SharePoint

Filed under: SharePoint — Tags: , , , — hristopavlov @ 7:22 am

A developer asked me today why SharePoint doesn’t use the Id specified in the ListIntance feature manifest for the guid of the list to be created. I checked the MSDN documentation and found out that the Id should be actually an integer number rather than a Guid:

Looking at the SharePoint code with reflector revealed that the class that is responsible for activating a ListInstance feature is Microsoft.SharePoint.SPListInstanceElement which actually completely ignores the Id attribute. It creates the list the “normal” way and the list instances will always come with a different and unique guids.

internal SPList Microsoft.SharePoint.SPListInstanceElement.EnsureListExists(SPWeb web)


    SPList list2;



        return web.Lists[this.Title];


    catch (ArgumentException)


        Guid guid;

        int num;

        string str;

        string documentTemplate;

        SPListTemplate.QuickLaunchOptions off = SPListTemplate.QuickLaunchOptions.Off;

        if (string.IsNullOrEmpty(this.TemplateType))


            return null;





        num = int.Parse(this.TemplateType, NumberFormatInfo.InvariantInfo);

        str = base.FeatureDefinition.Id.ToString();

        documentTemplate = null;


        guid = web.Lists.Add(this.Title, this.Description, this.Url, str, num, documentTemplate, off);

        if (!(guid != Guid.Empty))


            return null;


        return web.Lists[guid];






  1. […] The Id attribute of a ListInstance feature is ignored by SharePoint […]

    Pingback by Links (9/18/2008) « Steve Pietrek - Everything SharePoint — 19 September, 2008 @ 12:55 am

  2. I was looking for the same thing today thinking the listinstance ID would be a guid that would be the listinstance ID, then in my Schema definition for another list I can reference that list instances guid in the schema.


    So is my only recourse a feature receiver to map that list to the lookup field ?

    Comment by BinaryJam — 13 October, 2008 @ 12:32 pm

  3. Hi BinaryJam,

    You can actually specify the site relative list Url for the List attribute value when defining a lookup field. SharePoint will try to locate the list by the given url at the time the field is provisioned. i.e. you can go:

    <Field Type=”Lookup” List=”Lists/Tasks” …. />

    Comment by hristopavlov — 14 October, 2008 @ 12:27 am

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a free website or blog at

%d bloggers like this: