4

Is there a way to restrict the out of the box document libraries like "Document Library" "Picture Library" etc and just have custom document libraries being shown in the pop-up below?

enter image description here

2 Answers 2

3

Is your requirement to hide the action or prevent users from creating new lists in the SharePoint site? You could prevent users from creating lists by making them a contributer or create a custom permission level.

You can use the SPRoleDefinition class to programmatically create a permission level. Take a look at

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.sproledefinition.aspx

Edit: There is another option. That is to unregister the document library list template from the site. You can do that by disabling the feature:

 Disable-SPFeature 00BFEA71-E717-4E80-AA17-D0C71B360101 -Url http://sharepoint/example
0

One solution for SP2013+ is to override "Noteworthy" section on the "Add an app" page.

The below script is mostly based on the following post Hiding the out-of-the-box Document Library in SharePoint 2013. Basically, a JSLink overrides Apps Noteworthy section:

var MyModule = MyModule || {};
MyModule.AppCatalog = MyModule.AppCatalog || {};
MyModule.AppCatalog.NoteWorthyOverrider = function (){

    var alterStorefront = function () {
        if (SP.Storefront != undefined) {
            var listedApps = SP.Storefront.StorefrontApp.get_currentView();
            if (listedApps == undefined || listedApps.$2i_3 == null || listedApps.$L_3 == null) { setTimeout(alterStorefront, 300); return; }

            listedApps.$2i_3.length = 0;

            for (i = 0; i < listedApps.$L_3.length; i++) {
                if (listedApps.$L_3[i].$2Q_0.Title === "Document Library") {
                    listedApps.$L_3.splice(i, 1);
                }
                if (listedApps.$L_3[i].$2Q_0.Title.indexOf("Insite") > -1 || listedApps.$L_3[i].$2Q_0.Title === "My Custom Library Template") {
                    listedApps.$2i_3.push(listedApps.$L_3[i]);
                }
            }

            SP.Storefront.StorefrontApp.get_currentView().updateUI();
        }
    };

    return {
        AlterStorefront : alterStorefront
    }
}(); 

if (window.location.href.indexOf("_layouts/15/addanapp.aspx") > 0 || window.location.href.indexOf("_layouts/addanapp.aspx") > 0){
    SP.SOD.executeFunc("sp.js", "SP.Storefront", MyModule.AppCatalog.NoteWorthyOverrider.AlterStorefront);
}

Notes:

  • This solution will not "hide" ootb templates, users can still find them using Search box.
  • Applies to SP2013+

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.