Create a SharePoint List Definition Project

Monday, August 22, 2011




In This Excise we will to create List Definition with Visual Studio 2010 Solution using SharepOint2010 Project Template.

1. Open Visual Studio 2010 by going to Start Menu | All Programs | Microsoft Visual Studio 2010 | Microsoft Visual Studio 2010.
2. From the Visual Studio 2010 menu, select File | New | Project....
3. Select the Visual C# | SharePoint | 2010 | List Definition project template.
4.you can Enter any name like Bugs in the Name textbox.
5. Entery yourlocal location on your Computer in the Location textbox.
6. Click Ok.
7. In the SharePoint Customization Wizard:
8. Enter http://intranet.usama.com/ for the local site.

9. Set the trust level to Deploy as a farm solution.
10. Click Next.
11. Enter Bugs in the What is the display name of the list definition? textbox.
12. Select Custom List in the What is the type of the list definition? drop-down box.

Tick Add a list instance for this list definition

14. Click Finish.

Customize SharePoint 2010 List Definition and List Instance

customizing the List Definition project template by changing the list name, the content type it stores, and the fields that are displayed in the new, edit, and display forms :).

  1. In the Solution Explorer, expand ListInstance1 and open the Elements.xml file.
  2. Within the ListInstance element change the Title attribute to Bugs and change the TemplateType attribute to 10001.
  3. In the Solution Explorer, open Elements.xml.

  4. Within the ListTemplate element, change the Type attribute to 10001 and add the DisallowContentTypes=”FALSE” attribute, as shown below. DisallowContentTypes="FALSE"
  5. Insert the following xml into the top of the Elements element in the Elements.xml file. This XML describes the Fields the Bug Item content type uses.
  6. Insert the following xml into the top of the Elements element in the Elements.xml file. This XML describes the Bug Item content type the list will store.
  1. 7 The Elements.xml file should now look like the following.


8. In the Solution Explorer, open Schema.xml

9. Add the EnableContentTypes=”TRUE” attribute to the List element inside of the Schema.xml file.
10. Insert the following XML into the ContentTypes element in the schema.xml file. This XML describes the Bug Item content type this list will store.
11. Insert the following XML into the Fields element. This XML describes the fields the list will store. These are directly related to the fields in the Content Type we added in the previous step.
12. Insert the following XML into the ViewFields element in the 2nd view, BaseViewID="1". This XML describes which fields should be visible in this particular view. BaseView 1 is set as the default view and this is the view the newly created fields should display in.
13. From the menu, select Build | Deploy Bugs.
14. Open http://intranet.usama.com in a browser session. Under Lists in the left-side navigation, click on Bugs.







22. You have successfully customized the List Definition and List Instance

By Usama Wahab Khan
MCC,MCP,MCTS(SharePoint2010)
share this post
Share to Facebook Share to Twitter Share to Google+ Share to Stumble Upon Share to Evernote Share to Blogger Share to Email Share to Yahoo Messenger More...

0 comments: