SharePoint: Create permissions on list views

Permissions

on Nov 18, 2010 by Elio Struyf with 34 comments

First of all I've tried the same approach for SharePoint 2010 and this works the same way.

One of the things I miss the most in SharePoint 2007 is to set permissions on list views. I thought it was impossible to achieve this with the out-of-the-box functionality of SharePoint. After some research I found a way to achieve all this. My goal was to do it without writing or modifying any code in SharePoint. The solution consists of a number of manual steps, that I will describe in detail below, to accomplish this.

The idea was to place a list view inside a document library, so you can handle it as an ordinary document inside a list.

SharePoint Designer 2007 is necessary for the following steps.

  1. Create a new document library. I named it "ViewsLib", and I do not let it be shown on the quick launch.

    ViewsLib Library

    This document library will be used to store the list views.

  2. Open the site in SharePoint Designer
  3. Right click on the list for which you want to create a new view, and choose "New" -> "List view page".

    Create a List View Page

    Create a new list view.

  4. Give up a name for this view and click "OK".

    Enter the list view name

    Fill in the list view name

  5. Copy and paste the newly created view to the document library.

    Paste the view

    Paste the view to the document library.

  6. Delete the view from the list, you do not need this one anymore. You will only need the one inside the document library.
  7. Go to the site and check all the list views. The new view should be available.

    Check list views

    Check list views.

  8. Modify the view to suit your needs.

    Modify the list view

    Modify the list view.

  9. Inside the document library you can set item permissions on the view (ASPX Page).
    Manage item permissions

    Manage item permissions.

    Edit item permissions.

    Edit item permissions.

When you test this view you will see that SharePoint will redirect you to the page in the document library.

So this is all you need to do. When you check the view with a user that has no permissions, he will get an access denied.

Reader Test View

Test the view with a user that has no rights.

Access Denied

The user will get an access denied on the view.

Changes

Updates for Document Libraries: 31/05/2012

The previous approach does not work for Document Library views. When you try to copy the files you retrieve the following error message:
Server error: You cannot copy or move files between the Forms directory and a document library. First copy the file outside of the site and then upload from that location.

The following approach can be followed in order to achieve a restricted view for document libraries.

Step 1

Create a new list view for the document library, and navigate to the document library in SharePoint Designer.

Document library view

Document library view

Step 2

Double-click on the list view, this will open the list view in SharePoint Designer.

Step 3

Click File -> Save As.

Save As

Save As


In the save as pop-up windows, navigate to the list view document library, and save your file.
Save in

Save in

Step 4

Delete the old list view from the document library.

Delete the old list view

Delete the old list view

Step 5

Now you can set the item permissions on the document library view. The new view will already be available in the document library.

Document Library View

Document Library View

34 Responses

  1. Tweets that mention SharePoint 2007: Create permissions on list views -- Topsy.com

    November 19, 2010

    [...] This post was mentioned on Twitter by Jim Ongena, Elio Struyf. Elio Struyf said: Created a new blog post this morning about #SP2007 List View Permissions. http://bit.ly/bWFraJ [...]

    Reply
  2. Jeanne

    October 18, 2011

    I am trying to do exactly what you described to create permissions on list views. However, I have Sharepoint Designer 2010, and wondering how to do it with that. I am not an IT person, so I am struggling to get this to work with confidential information.

    Thanks

    Reply
    • estruyf

      October 18, 2011

      Jeanne,

      In SharePoint Designer 2010, click on All Files, navigate to your list;

      Create a new list view;

      Paste the view

      Copy your list view to a document library;

      Then you can do the same steps as in SharePoint 2007.

      Regards,
      Elio

      Reply
  3. Simone

    December 13, 2011

    This seems not to be working for BPOS… I get error while copying the view in the Lib:
    “You cannot copy or move files between the Forms directory and a document library. First copy the file outside of the site and then upload from that location”

    Reply
    • estruyf

      December 14, 2011

      Simone,

      It could be that it only works for lists, need to check it.

      Regards,
      EStruyf

      Reply
  4. Sagar

    January 14, 2012

    It worked for me on the list view. Thank you.

    Reply
  5. Dmitry

    February 9, 2012

    Nice!

    Reply
  6. Sarah

    February 10, 2012

    I created the view but don’t see how to copy and paste it into the library?

    Reply
    • Sarah

      February 10, 2012

      Working with SP 2010

      Reply
    • estruyf

      February 13, 2012

      If you open your the list in All Files, you can right-click on the list view and copy it.

      Copy List View

      Reply
  7. Toros

    February 24, 2012

    Very nice hack, does exactly what it’s supposed to do. Well done sir.

    Reply
  8. Toros

    March 23, 2012

    Can’t do this with document library views. Suggestions?

    Reply
    • estruyf

      March 28, 2012

      Toros,

      Until today I did not find a solution for document libraries.

      Regards,
      EStruyf

      Reply
  9. Heather

    May 25, 2012

    Great post, but I can’t seem to find where I can edit the view I just created for my list….once the view is selected from the drop down on the list it of course takes me to the ViewsLib…I know its here, but having a hell of a time finding it.

    Reply
    • estruyf

      May 29, 2012

      Heather,

      You will need to do this in SharePoint Designer, unfortunately this does not work directly in the browser. It is best to first create your view with all your sorting and filtering, and then do the permission actions.

      Regards,
      EStruyf

      Reply
  10. Tima

    May 30, 2012

    HI, Estruyf!
    I tried to do how you ve discribed in your case, but when I tried to copy the view in the Lib:
    “You cannot copy or move files between the Forms directory and a document library. First copy the file outside of the site and then upload from that location”
    Are there anu solutions of this problem?
    Thanks in advance!
    Tima

    Reply
    • estruyf

      May 30, 2012

      Tima,

      Thank you for your comment. Other people have also noticed this problem when they tried moving views from document libraries.

      I just tried something else. When you create the view and it is finished, click File -> Save As and save the file to the other Library. The other view can be removed from the library.

      I will update my post.

      Regards,
      EStruyf

      Reply
  11. Baz

    June 5, 2012

    This works wonderfully for me.. Thanks

    Reply
  12. Michelle

    June 5, 2012

    This worked exactly how it was described. Nice work and Thank you for sharing.
    I would like to know what happens behind the scene. How does the list know where the view is stored?

    Reply
    • estruyf

      June 7, 2012

      Thank you for the comment.

      I’m not sure what happens behind the scene, but it would have something to do with the document library references in the web part.

      Regards,
      EStruyf

      Reply
  13. Tami

    July 4, 2012

    Thanks!

    Reply
  14. Matt

    September 20, 2012

    This works great for me, with one exception, once the list is in the doc libr you can no longer use the sharepoint features like export to excel, etc etc. that whole navigation bar is gone. i guess this is lost in the “work around”. what i mean is instead of Browse,Items,List in the navigation bar, all you get is Brows,Page. which has a lot of functions missing. I have confirmed it is not a permission issue.

    Reply
    • estruyf

      September 20, 2012

      Matt,

      This will probably have something to do with that the view is stored in another library, and so it will not show the Library Tools tab.

      Regards,
      EStruyf

      Reply
  15. Himyee

    October 29, 2012

    My problem is the new “Restricted View” still inherits the permission from the “Original View”, even I have set different permission level in “ViewsLib” –> “Restricted View”
    e.g. In “Original View”, I have user A (Full Control), user B (Read only), user C (Full Control)
    In “Restricted View”, I have user A (Full Control), user B (Full Control)
    User C get access denied because it does not exists which is true, but user B still is read only in “Restricted View”. Any suggestions?

    Reply
    • estruyf

      November 5, 2012

      Himyee,

      This is a “list view” permission not the permissions of a item or document.So for example user B will still have read only permissions to the documents shown in the “Restricted View”, you gave user B only full control permissions on the view itself.

      Regards,
      EStruyf

      Reply
      • Himyee

        November 6, 2012

        Will Sharepoint 2010 has this feature instead ?

        Reply
        • estruyf

          November 6, 2012

          Nope, it works the same way as in SP2007.

          Regards,
          EStruyf

  16. Jordan

    March 13, 2013

    Very cool work around. It’s unfortunately SharePoint has so many quirks in it’s structure and features. (like how this doesn’t work for Document Libraries) As a SharePoint developer I don’t have access to files on the server and this makes it impossible to revoke access to Document Library views.

    My other logical thought was to remove the “Manage Views” contextual ribbon item for all Document Library objects. Thus far I haven’t had any luck finding out how to do this.

    Thanks for the awesome tutorial! It’s blogs like yours that make SharePoint bearable.

    Reply
  17. Jordan

    March 13, 2013

    Hours after encountering this head scratching problem I found a neat solution.

    Please read the first solution for this question: http://stackoverflow.com/questions/6025606/apply-css-on-a-specific-sharepoint-ribbon-bar-button

    By hiding the “Manage Views” area of the ribbon we can mostly prevent users from changing views on certain lists and libraries. To present lists and libraries with a specific view we can create a page containing a dataview webpart and configure it to have a certain view. Next simply use Audience Targeting to show/display links to that page containing the list/libraries. Audience targeting can also be used on web parts within these pages specifically.

    It’s still not perfect, but a pretty good in-between solution.

    Reply
  18. Olish

    September 27, 2013

    Thanks!

    Reply
  19. cz

    October 22, 2013

    Has anyone tried this with SharePoint 2013 yet?

    Reply
    • Scott

      February 25, 2014

      Yes, but unsucessfully. It appears that when I save the file back into the Forms directory, the permissions are overwritten. I’m curious if that’s because my DocLib is inheriting permissions. I’m not motivated to test that, since where I need this to work requires the inherited permissions.

      Reply
  20. Chandana

    June 11, 2014

    I want to know what if I want to modify the copied list view ( adding/removing a column) after I copy that to Document library. Is it possible to change the view.

    Reply
  21. Katleen

    June 19, 2014

    Hey

    Thank you for this article. I’m testing it in Sharepoint 2010 for our Intranet. I wanted to give users on a list view with only their own items, Contribute permissions. I have one strange behaviour though: when the list view is empty, they do not see the Add new item button. Any suggestions?

    Reply

Leave a Reply