Set Permissions and Restrict Access to SharePoint Views
Little background: PMO from Sales domain came with this requirement: They Have a list for capturing project metrics in a project collaboration SharePoint Site with below columns:
There are two requirements:
For the second requirement, Program Manager should get all projects, nothing comes to my mind other than creating a separate view without filters. But how do we restrict normal users/ project managers from accessing the view for Program Managers? (of course, PMOs can create private views, but they don't wanted to!). So, Lets restrict access and secure view by setting permissions.
1. Create a List view page in the list, Say "PMO.aspx"
2. Move the View to any document library (E.g. to "Site Pages" library)
3. Break the Permissions of the page, Grant access to "Program Managers" group
4. Move the View page back to List.
Here is the detailed Step by Step:
Step 1: Create a List view page in the list
Open the site in SharePoint Designer, Navigate to the List (say: Project Metrics), Right click the List in Treeview >> Click on "New" >> List View Page
Give it a Name, Say: "PMO" and click "OK". This will create new aspx page: PMO.aspx.
Step 2: Move the View Page to "Site Pages" Library
Since lists doesn't provide a way to apply item level permissions on list view forms, we need to move the list page to a document library, Apply the permissions and then move the view page back to the list. So lets cut the PMO.aspx from Project Metrics List
Paste the PMO.Aspx into "Site Pages" Libary
Set permissions on SharePoint views: Now, Navigate to "Site Pages" library from browser. Click on "Manage Permissions"
Click on "Stop Inhering permissions" from Ribbon to break the list view's permissions.
Leave the users/groups who needs access to the view and remove all others. By this we have restricted access to views with required users and groups.
Now, Go back to the SharePoint Designer, Cut the page from "Site Pages" Library and Paste it back to "Project Metrics" list.
That's all, We are done setting permissions for SharePoint view!
When users logged in to the site, they'll get to see the secured view.
But if they try to access our secured view "PMO" which is restricted access, they'll get "Access Denied"
There are two requirements:
- When Project Managers logs in, they should get projects in which they are assigned as "Project Managers".
- When Program Manager logs in, He should get all of the projects.
For the second requirement, Program Manager should get all projects, nothing comes to my mind other than creating a separate view without filters. But how do we restrict normal users/ project managers from accessing the view for Program Managers? (of course, PMOs can create private views, but they don't wanted to!). So, Lets restrict access and secure view by setting permissions.
How to restrict views in SharePoint 2013?
SharePoint doesn't provide any direct ways to Set Permissions and Restrict Access to SharePoint Views Out-of-the-box. Lets use this trick to get the permissions applied to SharePoint list views.1. Create a List view page in the list, Say "PMO.aspx"
2. Move the View to any document library (E.g. to "Site Pages" library)
3. Break the Permissions of the page, Grant access to "Program Managers" group
4. Move the View page back to List.
Here is the detailed Step by Step:
Step 1: Create a List view page in the list
Open the site in SharePoint Designer, Navigate to the List (say: Project Metrics), Right click the List in Treeview >> Click on "New" >> List View Page
Give it a Name, Say: "PMO" and click "OK". This will create new aspx page: PMO.aspx.
Step 2: Move the View Page to "Site Pages" Library
Since lists doesn't provide a way to apply item level permissions on list view forms, we need to move the list page to a document library, Apply the permissions and then move the view page back to the list. So lets cut the PMO.aspx from Project Metrics List
Paste the PMO.Aspx into "Site Pages" Libary
Set permissions on SharePoint views: Now, Navigate to "Site Pages" library from browser. Click on "Manage Permissions"
Click on "Stop Inhering permissions" from Ribbon to break the list view's permissions.
Leave the users/groups who needs access to the view and remove all others. By this we have restricted access to views with required users and groups.
Now, Go back to the SharePoint Designer, Cut the page from "Site Pages" Library and Paste it back to "Project Metrics" list.
That's all, We are done setting permissions for SharePoint view!
When users logged in to the site, they'll get to see the secured view.
But if they try to access our secured view "PMO" which is restricted access, they'll get "Access Denied"
great tips
ReplyDeleteThis is wonderful!! Thank you so much.
ReplyDeleteThank you so much. This tip helped a lot--so simple indeed.
ReplyDeleteWhat happens when they try to view the item in the view they do have access to?
ReplyDelete"Access Denied!" Error appears only when they try to view the specific "View" page. It doesn't control DispFarm.aspx
DeleteYou are amazing! Thank you!
ReplyDeleteThis has been a long time ask of customers! Can't believe I finally discovered your article. Thanks so much!
ReplyDeleteDo this work for SP2013?
ReplyDeleteMaybe
Deletethis tips works on sharepoint 2010 or there is something else?
ReplyDeleteVerified on SharePoint 2013 & 2016 as well.
Deletesome alternative for sharepoint 2010?
DeleteHi Salaudeen, would this work with Sharepoint Online and SPD 2013?
ReplyDeleteDo you need to have designer enabled?
ReplyDeleteThis solution with target audience, hidding of view
ReplyDeleteThxs for the nice solution. But what about the Search ? You can see everything from here... Is there any way to prevent the search on a list ?
ReplyDeleteYou can exclude a list from search indexing from list settings. SharePoint search results are security trimmed by default! (If you don't have access to any item, you won't see it in search results)
DeletePerfect workaround, many thanks for sharing!
ReplyDeleteThis was a great help to me. Thanks
ReplyDeleteHi
ReplyDeletenot sure if you are still responding, but I found a problem with this.
I on my test account I too get the following:
Access denied. You do not have permission to perform this action or access this resource.
But if you use the Export to Excel option in the ribbon, it allows you to export the data including all the content to Excel.... is there something I have missed?
This approach sets permission only to the specific view - not to the list or list items!
DeleteHi Salaudeen,
ReplyDeletedoes it work also for Sharepoint 2019 (on-prem) ??
thanks for you answer :)