SharePoint 2013 – Remove recent in the quick launch

SharePoint 2013 contains a new feature that creates a Recent shortcut in the quick launch. This shortcut appears after creating a new app. One of our customers doesn’t want to use this feature. There is only NO out-of-the-box feature to remove it. Very strange. I asked on SPYAM how to remove the shortcut. I received the following answer from Jussi Roine:

The Recent-section gets added automatically through a WebControl on the page. To automatically remove the who section (including child navigation nodes of Recent) you could enable a custom feature, that simply does a .Delete() against the corresponding navigation node in SPWeb.Navigation.QuickLaunch navigation collection. 

Then just call your custom feature from your provisioning logic, and way Recent -section would always be removed upon provisioning a new site. 
Alternatively you could use some CSS-styling but that wouldn’t really remove it, but just hide.


Hopefully this can set you in the right direction. Thanks Jussi!

Edit


Thanks to my visitors for leaving valuable replies! Another solution is:

jQuery(document).ready(function() {
jQuery
(".ms-core-listMenu-item:contains('Recent')").parent().hide();
});

14 thoughts on “SharePoint 2013 – Remove recent in the quick launch”

  1. What I did:
    Added a jQuery reference to my master page and added the following script to the end of these closing tags. If you use $(document).ready, you see the updating of the page.

    This script gets rid of it as it is created. SharePoint:SPTreeView SharePoint:SPRememberScroll Template_Controls
    SharePoint:DelegateControl
    SharePoint:SPNavigationManager
    script type=”text/javascript”>
    var parent = $(“span.additional-background:contains(‘Recent’)”).parent();
    var parentul = parent.parents(“ul”);
    var childli = $(parentul).find(“ul”);
    parent.replaceWith(childli.html());
    childli.remove();
    parent.hide();
    script>

  2. And in vanilla JavaScript if you don’t need/want jQuery (doesn’t work in IE<9):

    if (document.getElementsByClassName != "undefined") {
    var qlItems = document.getElementById("DeltaPlaceHolderLeftNavBar").getElementsByClassName("ms-core-listMenu-item");
    for (i = 0; i < qlItems.length; i++) {
    if (qlItems[i].innerHTML.indexOf("Zuletzt verwendet") != -1 || qlItems[i].innerHTML.indexOf("Recent") != -1) {
    qlItems[i].parentElement.style.display = 'none';
    }
    }
    }

  3. There’s a much simpler way, and no code required. Go to “Site Settings”, “Navigation”, then select the “Recent” folder and edit the audience targeting setting and add a SharePoint Group that you want to be able to see the Recent folder (create a Group first if you don’t have one). If there is no-one in the SharePoint group, then no-one will see it anymore.

Leave a reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.