Nov 27, 2014
In Microsoft SharePoint
, the only straightforward way to hide a view from public is to set it as a "Personal View." This way, only you can see the view and others can’t. This is not good enough though, because quite often you want a view to be used by certain group of users while other users see other views.
Well, there is no straightforward solution to this, as views are not securable objects; however, there are a few workarounds. Each solution works for a certain situation and has some limitations.
During the next few blog posts, I’m going to show you ways to achieve each of those. So here’s the first solution;
Apply permissions on web parts
Although you cannot set permissions on views, you can somehow apply them on web parts. So the solution is to create a web part for each view and set permissions on them. Here are the steps to do this.
- Create 2 views for a list and call them "View1" and "View2."
- Create 2 security groups, and let's call these "Titans" and "Villains."
- Go to the list and edit the page (using Site Action). You should now see two sections on the page. The top section is “Add a Web Part” and the bottom section showing you the list inside a Web Part.
- At the top right corner of the list web part, you should see a drop down arrow. Click on it and select "Edit Web Part." After a while, you should see a task pane appearing on the right hand side of the page. You may have to scroll to the right to see it.
- On the task pane, select the first option in the drop-down called "Selected View" and select View2. By this, you are telling the web part to show the list by its View2.
- Expand the "Advanced" section of the task pane, scroll down and find the box called "Target Audience." Type in Villains, which is the name of the security group you created in step 2. Click OK.
- Click on "Add a Web Part" at the top of the page and select your list from the list of web parts and click on the "Add" button.
- Repeat steps 5 to 9 to add View1 to the "Selected View" and "Titans" to "Target Audience" of the web part.
- Your page now has two list web parts each with a different security and view. Save your page and test it.
Of course, you can expand this to multiple views and groups. One thing you need to be aware of is that if a user is a member of both the Titans and Villains group then that user will see both views on the same page.
You should make sure that the groups used for the target audience are mutually exclusive.
Stand by for other ways to achieve permissions on list views!