2

I'm trying to figure out how to show a view of a library only to users who are a member of a SharePoint group, which is also specified in the document library as a value in a column.

Example:
If I add a document and I need to add extra information about that document to a column named "Groups" and I add a group named "Administrators", then I want to make sure only members of the "Administrators" group can see that document. When I add another document and this time add a group named "Visitors" to the "Groups" column, then only members of that group should see that document but not the document I uploaded earlier (so not the one only members of the "Administrators" group should see).

Basically, view permissions on document level.
I'm trying not to sound too complicated here, but language might be a barrier.
I tried the answer that was mentioned in this question but it does not seem to work for me.

I thought this would work if I set a filter where I'd select the column containing the name of the group (it's a person or group column) and then check if it contains [Me]. Unfortunately that gave me an error similar to the screenshot posted in the question I mentioned above, and even if I change it to "equals" instead of "contains" it doesn't give the desired result (no more error though, but not a solution either).

I made sure that the page that holds the library web part has been checked in, as well as the web part being updated by reselecting the view, yet it is to no avail.

Any help about this would greatly be appreciated.

  • 1
    Is there any reason to go with views instead of item permissions? You could break role inheritance and assign permissions on each document in event receivers. – Naim Murati Mar 19 '14 at 15:57
  • 1
    Well the page that holds the web part should be accessible by all members, but the library in the web part should only show items to users who are allowed to see them. And also I can't assign permissions by using event receivers, I can not use C# for this. – Magali Mar 19 '14 at 16:06
3

If you are only concerned about what documents users can see in the web part you are making then this is relatively straightforward using the Audience Targeting option in the web part.

To do this you would make a web part for each of the different user groups, and for each one input the respective audience in the web part settings.

The audience targeting option is in the advanced section of the web parts options.

Note: this would only restrict which web part your users see, it wouldn't actually restrict which files they could access. If you want to limit some documents to only be openable by an administrator for example, you need to change the user permissions on that document. If that is your aim you are possibly better creating separate document libraries for the different access levels so that you can assign permissions to them.

  • 1
    You can create permissions for a folder/folders within a library as well. This is a middle ground between item level security and having separate document libraries with different permissions. – lwbecker2 Mar 19 '14 at 16:24
1

You can apply a workflow on the library and change permission there according the group specified; this would work if the users can create/modify documents in the library. if the ability to add documents belongs a certain user, audience would work good.

  • But that's not a solution, I don't need to change the permission. I just need to be able to change the view. – Magali Mar 20 '14 at 9:20
1

I solved it by adding a Membership element in the CAML query for the view with the filters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.