Back again from a rare complete one day off (no office, no reading, no learning,
only cooking)….News is I was one of the many people who got
Star Performer Award in my office last week. One more feather in the cap.
Sometimes motivation is needed to keep you going.
List Instance :
List instance is one of the easiest SharePoint artifacts to create declaratively
(element manifest). So much content available on internet about it. Hence I was
thinking not to write about it, but later on I thought my blog should be a single
source to learn about all SharePoint artifacts, mostly if it is related to custom
development. Hence giving some links to read.
<ListInstance Title="Company Announcements " OnQuickLaunch="TRUE" TemplateType="104" FeatureId="00bfea71-d1ce-42de-9c63-a44004ce0104" Url="Lists/Company Announcements" Description="This list is used to create and store company announcements"> </ListInstance>
|
List instance can also have default data.
A new very useful attribute CustomSchema introduced in SharePoint 2010
<ListInstance FeatureId="{00bfea71-e717-4e80-aa17-d0c71b360101}" TemplateType="101" Title="Lending Proposals" Description="" Url="Lending Proposals" CustomSchema="Files\Lending Proposals\Schema.xml" RootWebOnly="FALSE" OnQuickLaunch="TRUE" > </ListInstance>
|
If you don’t have control over schema.xml, then you will need to use ContentTypeBinding
element for associating the content type with list instance.
If you are creating external list, then you will need to use DataSource element to specify the details about external LOB system.
e.g
<ListInstance
FeatureId="{00bfea71-9549-43f8-b978-e47e54a10600}"
TemplateType="600"
Title="Customers"
OnQuickLaunch="TRUE"
Description="This list has existing customers fetched from SQl."
Url="Lists/Customers"
>
<DataSource>
<Property Name="LobSystemInstance" Value="CustomerModel" />
<Property Name="EntityNamespace" Value="DemoApplication.CustomerModel" />
<Property Name="Entity" Value="Customer" />
<Property Name="SpecificFinder" Value="ReadItem" />
</DataSource>
</ListInstance>
|
Points to remember:
- ID parameter does not control the GUID of the list instance to be created. It is not even GUID. It could be any string value.
- FeatureId – This should be the GUID of feature who created the list template/ list definition used to create list instance. If list instance and list template are contained within same feature, then mentioning FeatureId attribute is not required.
- If your site is localized into multiple languages, then you might come across the issue mentioned in the http://blogs.msdn.com/b/manuj/archive/2009/10/08/contenttypebinding-listurl-and-multi-lingual-sites.aspx
- Desired List instance can be created in browser and then can be imported in Visual Studio using the technique mentioned in my blog Create List Template/ List Definition - Part 2
I think that’s all…
Fasting…no food no water….good thing is I need not to eat self-cooked food.