Sunday, May 16, 2010

Generating a list instance while specifying unique list id

While creating a list instance declaratively using a feature, we CANNOT specify a new guid for the list. Take a look at the following list instance xml.


<elements Id="c9cd45ea-9e77-46db-82a8-f583d6217fdb" xmlns="http://schemas.microsoft.com/sharepoint/">
  <listinstance FeatureId="74f16e44-083e-4c01-a9dc-051d0e9973e2" 
                Title="ITTP Test"  
    OnQuickLaunch="true"
                Url="Lists/ITTPTestList" 
    Id="{C6D63C55-A97E-49cb-BD5C-2110264CE19E}">
  </ListInstance>
</Elements>

In the above xml, "Id" attribute is completely ignored. To get the list id after it is created, we can use object model with URL.

No comments:

Post a Comment