Sharepoint 2010 Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint 2010       RSS Feeds

How to control Quick Lunch menu

  Asked By: SharePoint    Date: Oct 24    Category: Sharepoint 2010    Views: 2739

In our installation, I can see Quick Lunch menu bar is static for all. People used to get "Access restricted..." kind of error by clicking many of the links. My question is: Is there a way only to display relevant menu items to a user based upon her/his access rights?



5 Answers Found

Answer #1    Answered By: Dennis Tjassens     Answered On: Oct 26

It depends on the version of SharePoint you're working with.

If you are working with SharePoint foundation, the only option is to create a custom webpart displaying the quicklinks. This way you can set securitytrimming on the items by using something like:

<Sharepoint:SPSecurityTrimmedControl runat="server"....

If you are using SharePoint server you can use audiencing to control which users can view and access certain links.

Answer #2    Answered By: SharePoint Newbee     Answered On: Oct 26

Thanks again Dennis, it was my bad not to mention SP version. It is SP Foundation and so I need to create a custom webpart. Can you refer me to some link where I can get more information on how to do this? As you know, I am only a week old SP guy and will look forward for help.

Answer #3    Answered By: Dennis Tjassens     Answered On: Oct 26

Hey SPnewb,

Im willing to help but its probably best if you specify your requirements a little bit more. Do you want to make exactly the same as the quicklaunch or do you want to be able to show for instance only the pages library. It is also important to know how you want the layout of the quicklaunch to be.

Answer #4    Answered By: SharePoint Newbee     Answered On: Oct 26

At the onset, I appreciate your helping attitude and support.
I have couple of menu items at my quick lunch left navigation. Few of them are controlled. When a user logs-in, all menu items are available to him/her. By clicking an item from menu, user used to get "Access restricted..." kind of error if he/she does not have access to that particular library.
What I want here is, to display only the menus which the user has permission. I do not know why MS does not do this (perhaps since Foundation is free), but I am sure there is some work around.
Also I am not crezy to use quick lunch as only menu option. I am okay with any solution even if this can be done by using different menu (and not using quick lunch).
Let me know what you think.

Answer #5    Answered By: Dennis Tjassens     Answered On: Nov 01

What i once did for a customer is simply query a pages library. I then created a secondary navigation list with all the navigation items which existed and did a lookup to get all the data. Because of permissions on the pages in the pages list I only retrieved items which were relevant to the user.

List<Navigatie> navigatieItems = new List<Navigatie>();
Navigatie nav = null;

SPWeb web = SPContext.Current.Web;

//get pages list
SPList pagesList = web.Lists[Constants.ListNames.Pages];

//get pages items
var items = from SPListItem tItem in pagesList.Items
orderby tItem.ID
select tItem;

//get navigation list items
IQueryable<Navigatie> all = factory.Navigatie.All.OrderBy(x => x.Volgorde);
foreach (Navigatie item in all)
foreach (SPListItem menuItem in items)
if (item.Title == menuItem.DisplayName)
nav = new Navigatie();
nav.Title = item.Title;
nav.Navigatieurl = item.Navigatieurl;
return navigatieItems.AsQueryable();

After this bind it to an aspmenu

//create aspmenu
menu = new AspMenu();

foreach (Navigatie nav in navigatieItems)
string title = string.Empty;
string url = string.Empty;

if (!string.IsNullOrEmpty(nav.Title))
title = nav.Title;
if (!string.IsNullOrEmpty(nav.Navigatieurl))
url = nav.Navigatieurl;

item = new MenuItem(nav.Title, null, null, url);

if (pageViewed == item.Text)
item.Selected = true;



Don't know if this is helpfull in your particular case. If not let me know I will look for something else.

Didn't find what you were looking for? Find more on How to control Quick Lunch menu Or get search suggestion and latest updates.