Wednesday, November 5, 2008

How to remove Site Actions and View All Site Content

Hi all,

We had been asked so many times how to remove “Site Actions” or “View All Site Content” for certain users.

So finally we found one simple trick which will work for our system.

Problem statement: remove “Site Actions” or “View All Site Content” for certain user.

Work Around: to remove View All Site Contents and Site Actions we need to modify master page.

For us we are using custom master page. To know how to set custom master page as default master page check this Link .please try not to modify default.master page use custom one.

Removing Site Actions:
Open your master page in any editor like Visual studio (recommended) or notepad.
Find “SharePoint:SiteActions”.
If you opened it in Visual studio toggle the Site Action Control.
Check the screen shot.

Now add SharePoint:SPSecurityTrimmedControl control just before the SharePoint:SiteActions control
Check the screen shot.

Here is the text to add
<SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2" runat="server" PermissionsString="ManageSubwebs">

<<SharePoint:SiteActions control>>


Now here is the description what we had done.

SPSecurityTrimmedControl as the name suggest, the control check the SharePoint permission and if user is permitted (if the user have permission) then it will access the content inside this control.
And if the user don’t have a permission then the content inside this control will not been accessed.

PermissionsString attribute define which set of permission can access the control.

You can give multiple permission by “,” (comma).
This “,” will work as OR condition to the permission set.
To check the permission set Enumeration check this link of MSDN

There is no other way to hide this buttons but we can do like this way.

Chose a permission from above msdn link like ManagePermissions or ManageWeb or DeleteVersions
the permission that your user don’t have.

And set it in master page.
Because our basic requirement is the END user should not see “Site Actions” and our END user must not have at least one permission from the permission list. Even contributor does not have all the permission.

So you are done by doing this you can remove site actions for non admin users without coding.

Removing View All Site Content:

Find “~site/_layouts/viewlsts.aspx” in the master page.

You will find Sharepoint:SPSecurityTrimmedControl is already there but the
PermissionsString attribute is set as “ViewFormPages”.

Which means that if a person have view rights in the form pages then that person can see this link.

You can also change PermissionsString to high permission like ManageSubwebs or ManagePermissions or something like that so that this link will also be removed if the login user don’t have permission mentioned in permissionstring.

Hope this will solve our basic problem which must have high priority for the clients.


Amila Hendahewa said...

Great post.

When i tried this it only hides the "site settings" link in the "site actions" drop down. All other links such as "manage content and structure" are still visible.

How can I hide the entire drop down list?

Parth Patel said...

Hi Amila,

Find site actions drop down in master page

And use “SharePoint:SPSecurityTrimmedControl” control for user rights.

You can hide anything with using same control.

The post is regarding the same

To hide site actions dropdown

Find “SharePoint:SiteActions” in master page and wrap this site action with SPSecurityTrimmedControl control you work will be done.

Amila Hendahewa said...

Hi thanks,

yes it worked; there were some issues earlier in user rights assignment.

this helped a lot; thanks again.

Anonymous said...

Great post.

I am facing this problems since last one month and finally left this. But again searching and after viewing this post, I implement this process and find output.

Thanks alot..

Satsh Srivastva
New Delhi

Anonymous said...


that was so great
my problem also solved
thanks alot

Anonymous said...

I was able to remove the recycle bin but the view all site content will not go away. I set the permission string to ManagePermissions but users who only have read access can still see it. What am I doing wrong? I set the first trimmedcontrol you had us set up with the ManageSubwebs like in your example and that removed the recycle bin.

Anonymous said...

This is the correct way to do it. Please try this.


Anonymous said...


SharePoint Kings said...

PermissionsString="BrowseDirectories" will be used for hiding things from Anonymous user.

thanks deepak.

M.obulreddy said...

Hi All,

I want to hide the "Sign In" link in sharepoint site.i have tried this by using "SharePoint:SPSecurityTrimmedControl".

but displaying the "sign In" link in sharepoint site.

cam any one solve this issue.


SharePoint Kings said...


To make SharePoint:SPSecurityTrimmedControl work you have to check the user you logged in has which rights. and set SPSecurityTrimmedControl accordingly.

and if you want to remove this at all (for admin also) then add style with display:none;

quanticus said...

Hi there, is this solution working on a single site and inherits the user rights?

It seems that in my test allthough the user has different rights, the menu (view all site content) stays visible.

I'm using the ManageLists control so that the user should be a contributor, but the menu is not showing up (non of the (sub)sites).
And the user is a member on one of the sites.

Regards, Amancio

quanticus said...

Hi Problem solved. A closer look at the article:

gave me the following option: AddListItems (to indentify the contributors) for the View all site content.

And I used the ManageSubwebs to identify the owners for the site actions menu

Regards, Amancio

Kallis said...

Check this out:

SharePoint Kings said...

Hi Kallis,

thank you for your feedback.

Yes this post indeed shows how to do this trick, However this is true for only one single page as he has mentioned that i did on the page where i didn't want to show site actiosn and view all site content.

If you want to remove it from every where , use master page and make a change in it as mention in our post.

Thank you once again.

Adrian said...

Thanks for posting this, it is working on my SharePoint 2010 publishing web site now too.

Anonymous said...

Thank You!
Quick and easy - Sharepoint 2010


Nilios said...

Is there a way to do this without using SharePoint Designer in 2007?

SharePoint Kings said...

you can create your custom master page and use that. or add JavaScript which will find and remove that element from HTML.

JavaScript you can put in CEWP but then you have to put it on all the pages.

so better put JavaScript in master page is easy option. so its your choice- but best option is the one describe in post :)

Anonymous said...

What JavaScript would you use to hide that element?

SharePoint Kings said...

not had script handy at the moment but,
just view source and find proper div and write javascript on page page load or document.ready to hide it.

Anonymous said...

Thanks a lot for correct and valid description for "Site Action" bug.

However I would I remove "Site Action" only for users having reader member of group OR having read access.

Please let me know exact "PermissinoString" which will be included.


Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to