In this SharePoint tutorial, we will discuss how to create a SharePoint custom list template and set datasheet view as default view programmatically in SharePoint 2013/2016.
SharePoint provides a lot of ways to show the content of a list. SharePoint Views are one of them to present the data in different manners with different columns, styles, sorting, filtering, and grouping. In SharePoint, views can be of two categories: Public and Private.
- Public Views are available to every user who is a site member on the site.
- Private Views is available for only the user who has created that particular view.
SharePoint by default provides different types of view as Calendar View, Datasheet View, and Gantt View, etc.
Datasheet View displays the items in Microsoft Excel format that allows us to copy and paste data from and into the list.
Datasheet views in SharePoint 2010 are great for performing bulk updates on list items and document properties in a library. A Datasheet view is a great way to quickly change the content type of a list item or document.
Let’s Process Following steps to create a custom list definition (not a list instance) using the Visual Studio 2012/2013 etc with screenshots.
In Visual Studio select File -> New Project, Select Templates -> Visual C# -> Office/SharePoint -> SharePoint 2013 – Empty Project
Once the new solution has been created, we can use the new Visual Designer to create the List Definition. Right-click the project in the solution explorer and select Add -> New Item
Select Visual C# Items -> Office/SharePoint -> List, provide a name and click OK.
Provide a display name for the list. We just want to create a list definition, not an instance of the list; This isn’t an option so what we do instead is go with the “Create a customizable list template and a list instance of it”
List instance Select Schema.xml edits View Base view ID section Add Type =”Grid“ like below format for Datasheet view
<View BaseViewID="1" Type="Grid" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/15/images/generic.png?rev=23" Url="AllItems.aspx"> <Toolbar Type="Standard" /> <XslLink Default="TRUE">main.xsl</XslLink> <JSLink>clienttemplates.js</JSLink> <RowLimit Paged="TRUE">30</RowLimit> <ViewFields> <FieldRef Name="LinkTitle" /> </ViewFields> <Query> <OrderBy> <FieldRef Name="ID" /> </OrderBy> </Query> <ParameterBindings> <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" /> <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" /> </ParameterBindings> </View> </Views>
Save and deploy the solution in an extended web application, then Go -> Site Content Create New list user our own create Template for Custom List in Datasheet view (CustomDataSheetListTemplate)
You may like following SharePoint tutorials:
- SharePoint 2010 development with Visual Studio 2010
- Create a custom action group in SharePoint 2013/2016 using visual studio
- How to use asp.net repeater control in SharePoint 2013/2016 using Visual Studio
- SharePoint 2016 Develop and deploy custom feature using Visual Studio 2015
- SharePoint 2016/2013: Create list instance and list definition using Visual Studio
- Visual Studio 2015 Show All Files button missing in solution explorer
- Generate .app file for SharePoint Apps using MSBuild and Visual Studio
- SharePoint 2016 Project Template for Visual Studio 2015
- Create and deploy site pages or content pages using visual studio in SharePoint
- How to create site definition using Visual Studio 2013 in SharePoint 2013
- Create List Definition and List Instance in SharePoint 2013/2016 using Visual Studio
- Add navigation link in site settings navigation page SharePoint 2013 using Visual Studio 2013
This tutorial, we learned how to create a custom list template in SharePoint 2013 using visual studio, as well as we saw how to set datasheet view as default view programmatically in SharePoint 2013/2016 using visual studio.
Solutions. I am currently working on Sharepoint 2010, MOSS 2007, Sharepoint 2013,Sharepoint 2013 App Dev, C#, ASP.NET, and SQL Server 2008.
Download SharePoint Online Tutorial PDF FREE!
Get update on Webinars, video tutorials, training courses etc.