This site uses cookies and by using the site you are consenting to this. We utilize cookies to optimize our brand’s web presence and website experience. To learn more about cookies, click here to read our privacy statement.

Part 3 – The Solution: SharePoint 2013 Deploying Custom List Schemas: Calendars, Announcements, Tasks, and Picture libraries.

There are a few lists in SharePoint that have special features associated with them like the Calendar Tab that becomes available in the Calendar list, the summary view that is available in the Announcements list for web parts, and Picture thumbnails in the Picture Library. When attempting to customize these lists, if a list schema is created based on one of these in Visual Studio and then deployed, you will notice that the special features of these lists (like those mentioned above) are missing. It turns out that there is extra events that occur when these types of lists are created in a site that run based on the List Type ID, so when a custom list is created with a custom ID, the events to modify the lists do not run. So…let’s talk about how to get around this issue.

The approach that we are going to discuss applies to any list that needs to be customized, but has special features that appear to be missing after creation. I have used this approach when customizing Calendars, Announcements, Tasks, and Picture libraries successfully in SharePoint 2010 and SharePoint 2013, but it should work on any list with additional functionality that is missing. The key to solving this issue is deploying a list definition with the SAME list type id as the OOB version. But since we set our content types and views in a list via an event receiver, we need to ensure that our event receivers ONLY run on the custom list definitions and not all lists with that type…so in our if statement where we were previously checking the list template id we are also going to check the GUID of the feature that deployed that list.

Step 1 – Create a new list definition in Visual Studio

Step 2 – Delete all the files except the elements.xml file

Step 3 – Navigate to the 15 (or 14 hive) and navigate to TEMPLATES/FEATURES and find the feature folder of the list you are looking to create.

  • Calendar – EventsList
  • Tasks (SharePoint 2010) – TasksList
  • Tasks (SharePoint 2013) – TasksWithTimelineAndHierarchy
  • Announcements – AnnouncementsList
  • Picture Library – PictureLibrary

Step 4 – Open the ListTemplates folder within the feature folder and note the type of the list. Update your elements.xml file of your custom list definition with this type.

  • Calendar – 106
  • Tasks (SharePoint 2010) – 107 (still available in SharePoint 2013)
  • Tasks (SharePoint 2013) – 171
  • Announcements – 104
  • Picture Library – 109

Step 5 – Open the other folder within the feature folder, it will be called something similar to the feature folder name like Announce or Events. Copy all of the items in this folder and add them to your list definition.

Step 6 – The event receiver code that sets the content type, views, and other list settings does not change with this approach with the exception of the IF statement that validates it is running on the correct list. In Part 2, we discussed checking the list template id by using IF(properties.TemplateId == 30000), for these types of lists where we cannot deploy a custom list type ID, we need to elaborate on the IF statement to include the GUID of the feature that deploys the list definition. For example, if we are customizing a Calendar list and the GUID of the feature that deploys the custom calendar List is B3620DF9-A7C4-4F6A-8A6B-ECEEF2B87238 then the IF statement that must be validated before running the event receiver on the Custom Calendar list is IF(properties.TemplateId == 1090 && properties.FeatureId == “B3620DF9-A7C4-4F6A-8A6B-ECEEF2B87238”).

That’s all for the differences in deploying a list, the content type creation, view updating, deployment, and use of the list are the same as we have discussed or OOB functionality.