Filter SharePoint lists by user roles   

 

By now you probably know that you can only see items in SharePoint that you have access to. So security trimming your lists is pretty much built in.

The problem with assigning permissions to items so they won't be visible is that it takes a lot of work. It usually means that you need to break role inhertiance at some point and assigned the required permissions.

If possible you want to stay away from itemized permissions, specially if what you are really trying to do is just filter based on interest. MOSS has the Audience feature that does just that, however you still end up having to assign the Audience filter manually. Too much work!

I had a scenario where the tasks of a workflow were assigned to different groups. The users only wanted to see the tasks assigned to the groups they belonged to. Unfortunately you can't create a view to do this through the interface. But you can easily do it with CAML.

The WHERE sample below will only display items that have been assigned to one of the groups of the current user.

If you are not a developer you can still customize a view to use this clause with SharePoint Manager.

The where clause is using the Membership Element which can be configured to filter different membership types. In this case we are using the type CurrentUserGroups.

 CAML to filter items based on the groups of the current user


  
    
  

 CAML to filter items assigned to the user or to his/her groups


  
    
      
    
    
      
      
        
      
    
  
Published  on  8/19/2009  by  xsolon
0  Comments  |  Trackback Url  | 0  Links to this post | Bookmark this post with:          
Tags: | Categories:
Technorati Tags:
 

Links to this post

Comments

Title:
Receieve Notification:
Website:
Email:
Comments:

CAPTCHA Image Validation