Wednesday, May 20, 2009

How to remove Site Actions and View All Site Content

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<>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.

No comments:

Post a Comment