Monday, June 29, 2009

Restricting access to sharepoint views

Scenario:
Some one asked me how to restricting access to sharepoint views because he has a view with one column with information only meant for Contributors and not for Visitors.

Solution:
There is no out of box solution and they are many work-around for the problem.
Here's one which is simple and can be handled from sharepoint UI itself.

Steps ( Set 1 ) :

01. Go to the list you want to restrict the access.
02. Make sure AllItems.aspx , or your default view doesn't have the column you want to hide.
03. Now create a new View based on previous view, you can name it Contributors view.
04. Add the columns you want to show to Contributors View and save it.

Steps ( Set 2 ) :

05. Now go Site Actions > Create
06. Create a new Web Part Page with name "Contributors View", select the library you want to save it to.
07. Click on Add webpart option and Insert list view webpart by selecting the list name
08. Edit this webpart to point it to new View ( Contributors View )
09. Exit the editor mode

Steps ( Set 3 ) :

10. Go to library you have used in the above step.
11. Look for the page you have created.
12. From the context menu of the page > Manage Permission , Allow only Contributors

Steps ( Set 4 ) :

13. Now visit the list again ( trust me this is the last time )
14. List Settings > delete the view ( Contributors View ).

That's it , you are almost done 95%.
Missing 5% work goes to the solution you need to find out to provide some way for your Contributors to navigate to this newly created page. :-)

7 comments:

Senthil October 14, 2009 at 3:00 AM  

Nice Steps Sandeep, But looking back ,Still I can create a Private View for me with those Columns Right ?

Sandeep October 14, 2009 at 7:47 AM  

I will check that again but as far as I remember Visitors cann't create make a Personal View

Anonymous,  May 5, 2012 at 2:44 AM  

May I know what's the difference between deleting and not deleting the view in step 14?
Also, Dora your solution work for datasheet view only?
I tried your solution with standard view, if user click on the edit item, they should still get access to all the columns, is that right?
Thanks

Sandeep May 5, 2012 at 3:46 AM  

Agree.. I have another solution blogged for 100% security :)
I will check and post link soon

robLuis October 8, 2012 at 11:19 AM  

Ever documented the new solution?

Sandeep October 8, 2012 at 12:02 PM  

I guess yes.. I already blogged one - http://snahta.blogspot.in/2009/06/restricting-access-to-sharepoint-views.html

Anonymous,  April 26, 2016 at 8:40 AM  

Hi Sandeep,

Can you please share the powershell to delete personal view (in a Doc Lib) of a user.