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:
- 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.
To solve the first requirement, I asked them to set the view filter as: “[Project Manager] is equals to [ME]”, simple, uh?
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”