Sharepoint - How to hide recent in the navigation

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;
  }
}

You can manually delete the header from:

Site Settings-> Look and Feel -> Navigation


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.

Tags:

Navigation