I have a custom library template which I've been using on a lot of my sites. We then have Power Users which use this template to create new libraries when needed.

I'd like to make things a bit easier for the Power Users by adding a button/hyperlink to the page which automatically takes them to the New CustomTemplate page. For example, you can do this for a simple Document Library by linking them to:


How can I achieve the same thing with a Custom Document Library template? Do I need to find the FeatureID and include that in the query string as well?

2 Answers 2


Here is a solution based on O365/SharePoint 2013. Your mileage might vary if you're on a different version.

If you try to instantiate your custom list via the traditional way ('add an app' page) and grab the url of the resulting dialog, you will indeed have the feature ID in the query string, although it will be url-encoded, like this:


You'll want to strip out the IsDlg bit from your implementation, making sure the feature id is properly encoded, and attach this to your link.

Here's a quick and dirty untested script to acheive all that:

var templateID = "10001";
var featureID = "{your-feature-id-here}";
var encodedFeatureID = encodeURIComponent(featureID);
var newListUrl = _spPageContextInfo.webAbsoluteUrl + "_layouts/15/new.aspx?FeatureId=" + encodedFeatureID + "&ListTemplate=" + templateID;
$("#myLink").attr("href", newListUrl);

You can create a Custom page just like Sharepoint create document library page and programmatically add document library.

using (SPSite oSPsite = new SPSite("http://Web URL"))
    oSPsite.AllowUnsafeUpdates = true;

    using (SPWeb oSPWeb = oSPsite.OpenWeb())
        oSPWeb.AllowUnsafeUpdates = true;

        /* 1. create list from custom ListTemplate present within ListTemplateGalery */
        SPListTemplateCollection lstTemp = oSPsite.GetCustomListTemplates(oSPWeb);
        SPListTemplate template = lstTemp["custom template name"];
        oSPWeb.Lists.Add("List Name", "Description", template);

        /* 2. create list from sharepoint list content type (e.g. Links) */
        oSPWeb.Lists.Add("List Name", "Description", SPListTemplateType.DocumentLibrary);

        oSPWeb.AllowUnsafeUpdates = false;

    oSPsite.AllowUnsafeUpdates = false;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.