13

In SP2013 you have the recent entry in the navigation. Is there an easy way to automatically hide/remove this entry?

9 Answers 9

11

Did some additional research and found the answer myself.

var title = SPUtility.GetLocalizedString("$Resources:core,category_Recent", null, web.Language);
SPNavigationNodeCollection nodes = web.Navigation.QuickLaunch;
foreach (SPNavigationNode node in nodes)
{
  if (node.Title.Equals(title))
  {
    node.Delete();
    break;
  }
}
1
  • 1
    Where did you put this code? I put it in a Feature Event Receiver in the FeatureActivated event, & it didn't work :(
    – Markus
    Aug 4, 2015 at 15:22
6

You can manually delete the header from:

Site Settings-> Look and Feel -> Navigation

3
  • I am creating a webtemplate based on a teamsite. Do you know how this can be done by code?
    – Remko
    Mar 7, 2013 at 13:20
  • What is the result you are looking for? Should the navigation be inherited from the parent site? Mar 7, 2013 at 14:22
  • I already found and posted the answer I was looking for. Tnx for helping
    – Remko
    Mar 14, 2013 at 9:59
5

I have an out of the box solution.

  1. *Settings -> Site contents
  2. *Site permissions
  3. *Create Group
  4. Make a new group with no permissions.
  5. Delete all users from the group.
  6. *Settings -> Site contents
  7. *Navigation
  8. Select the "Recent" heading
  9. *Edit
  10. Set Audience = the group from step 4
  11. *OK
  12. *OK

Now only members of a group, with no members, are able to see the "Recent" heading.

1

With Sharepoint Online (Office 365) you can delete the Recent from the menu by doing the following:

  1. Select "Edit Links" at the bottom left of menu
  2. Click "X" next to Recent" to delete it and save

NOTE: You'll need to recreate the menu links under "Recent" if you follow these steps. Under each app you'll need to toggle the on/off radio button for "Display this list on the Quick Launch?" in the General Settings.

1

In SP13, just go to site settings > Look and Feel > Quick launch and click the recent link. You'll have to put in a url before it will allow you to delete.

1

The solution I used was to create a SharePoint group (I called mine "RemoveRecent") and have no users assigned to that group.

I then used this PowerShell script to add the "RemoveRecent" group into the "Audience Targeting" section of the "Recent" Quick Launch Navigation Link.

This effectively hides the menu item from everyone.

$Site = Get-SPSite "https://SITECOLLECTION/"

foreach ($Web in $Site.AllWebs)
    {
    $PublishingWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
    $QuickLaunchNav = $PublishingWeb.Navigation.CurrentNavigationNodes
    $QuickLaunchHeading = $QuickLaunchNav | where {$_.Title -eq "Recent"} 

    if ($QuickLaunchHeading)
        {
        Write-Host $Web.Title "- " -ForegroundColor Green -BackgroundColor Black -NoNewline
        $QuickLaunchHeading.Properties["Audience"] = "RemoveRecent"
        $QuickLaunchHeading.Update() 
        }
    }
1

Using jQuery: SharePoint 2013 - Remove Recent

<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>

<script type="text/javascript">
    jQuery(document).ready(function() {
  jQuery(".ms-core-listMenu-item:contains('Recent')").parent().hide();
  });
</script>
0
  1. Site Settings -> Quick Launch Select the Edit icon near Recent
  2. Copy any valid url into the empty URL box (Recent item does not show a URL)
  3. Click Delete (with an empty URL box, it would have given an error message)
  4. Confirm deletion

It works in SharePoint 2013, not sure about the earlier versions

-2

I decided as follows: Added the css code on the page that did not want to display the "Recent" menu:

div#zz12_V4QuickLaunchMenu ul#zz13_RootAspMenu li.static span.static span.additional-background{
display:none;
}
1
  • Never do this, since the IDs get changed mostly between every page refresh and every user. Though they fall in a range like zz12 to zz14....., we may never know May 11, 2018 at 17:36

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.