How to: create Promoted Links app in C# (SharePoint 2013)

Creating most types of lists (or apps in SharePoint 2013 terminology) in C# code is pretty straightforward. You just need to choose the correct list type from the built-in enum Microsoft.Sharepoint.SPListTemplateType. Then, you can create list by invoking appropriate Add() method on a SPListCollection, like in the first example:

However, this will not work for Promoted Link app, as it’s template is not among the built-in templates available in SPListTemplateType enum.

Creating Promoted Links will require using overloaded method Add(string title, string description, SPTemplate template). Please note, that the third argument is now SPListTemplate and not SPListTemplateType.

The string "promotedlinks" is the name of the template for the list with promoted links tiles. It’s language-neutral.

Be advised that though you could get SPListTemplate for Promoted links using bracket operator []web.ListTemplates["Promoted Links"] – this relies on the display name of the feature. It means, that in localized SharePoint webs (other than with en-US locale) this code will fail, as "Promoted Links" will not be recognized as name of any template type. Therefore, using LINQ to get the template by its internal name is much better choice.

After adding the list, you can add elements from C# code just as to any other type of list.

Sharepoint 2013 tiles

Sharepoint 2013 tiles