In Sharepoint 2010 Some time we need to create custom list definition - list content type.
or
It is very easy to create custom list definition with content types in sharepoint 2010
orToday i am writing all step to create custom list definition with content type ..?
Open Visual Studio 2010
New Project
Take Empty Sharepoint Project
Click on image to zoom |
Here i am creating as a sandbox solution
Give the Site Url
Click on image to zoom |
Go To Solution Explorer Add New Item
Select List Definition
Give the name of list definition Here i am giving name Employee List
Click on image to zoom |
Give the list definition type and name
Click on image to zoom |
From solution explorer under the list instance open Element.xml file
Click on image to zoom |
Modify Element.xml
Give relevant Title, description
Give Templatetype="100" for custom list
Give feature ID for custom list type 100 = 00BFEA71-DE22-43B2-A848-C05709900100
feature ID you can find from here
after all modification your xml look like this
Click on image to zoom |
Now Select Element.xml from solution explorer under the Employee List
Click on image to zoom |
Add Content Type (Give new Guid - create Guid From Guid Generator remove hyphens and add 0x0100 this is depend upon the list type)
Give FieldRef (use same filed guid)
after all modification your xml look like this
Click on image to zoom |
Now Select Schema.xml from solution explorer
Click on image to zoom |
Give Content Type Ref (take content type id from Element.xml)
after modification your code look like this
Click on image to zoom |
Under the fields add the fields name
Click on image to zoom |
Under the view fields modify like this
Click on image to zoom |
On header EnableContentTypes="True"
Click on image to zoom |
Now Build and deploy your solution ..
Go to Site Action > View All Site Content
You can find your list Employee List
Click on image to zoom |
If your List Content type is not configured you can configure like this
Go List Setting > Advanced Settings
Click on image to zoom |
Select Allow Management Content Type Yes
Click on image to zoom |
Now Go again list setting
Under the content types select Add from existing site content types
Click on image to zoom |
Add your content type from left box
Click on image to zoom |
Now Go again list setting
Under the content types select select default content type
Click on image to zoom |
Select your content type like below
Click on image to zoom |
Click on image to zoom |
You can use this content type ..
Go to Site Action > Site Settings > Site Content types > under the Custom Content Types
Click on image to zoom |
No comments:
Post a Comment