SharePoint: Create Records Library programatically

Following SharePoint server object model code can be used to create Records Library:
foreach (SPListTemplate t in web.ListTemplates)
{
    if (t.Type_Client == 1302)
    {
        web.Lists.Add("Sample Records Library", "Sample Records Library", t);
    }
}
Following can be use to check if the document library is Records Library:

SPListCollection lists = web.GetListsOfType(SPBaseType.DocumentLibrary);
foreach (SPList list in lists)
{
    if (list.Hidden == false && list.BaseTemplate.ToString() == "1302")
    {
        // This is records library
    }
}

profile for Nadeem Yousuf at SharePoint Stack Exchange, Q&A for SharePoint enthusiasts

+