Skip Ribbon Commands
Skip to main content

Laura Rogers @WonderLaura

:

Quick Launch

Laura Rogers @WonderLaura > Posts > Filter a View by “Me” Without a People Column
Hi everyone,
My blog now has a new URL!
You can now find me at http://www.wonderlaura.com
March 23
Filter a View by “Me” Without a People Column

This applies to the Enterprise version only, for SharePoint 2007 or 2010.

A lot of times, especially with InfoPath fields, you end up with a text field with a user’s name in it, instead of an actual people picker field.  The syntax may be something like DOMAIN\username.  In this post, I’ll use the example of “Current Approver”. This text field is not very useful, though, when trying to create a filtered view where that text field (Current Approver) is equal to [Me], the logged in user.  Sometimes if I’ve got a text field with a name in it and want users to be able to see a view of their own items, I’ll even create a new people field in the list, and create a workflow that copies the name value over from the text field to the people picker.  This gives a nice, pretty people field, and gives you the ability to filter by Current Approver is equal to [Me].

In this post, I’ll show you a quick way to show users a view of items applicable to “Me”, without having to go to the trouble of creating an extra people picker field just to be able to use [Me].

ch5[158]

Here’s the example list, and you see the “Current Approver” column is just a text field.  The next step is to filter this view so that the logged in user only sees items with their own name as the current approver.

  1. Click <Site Actions>, and choose <Edit Page>
  2. Click to Add a New Web Part, and add the Current User Filter web part to the page.
    ch5[159]
  3. Take a look at the current user filter web part settings in the web part toolpane.  You’ll notice that by default, the value that is stored in this web part is the current users' DOMAIN\username.  There is also a drop-down box where you can pick the user’s email address, department, etc.  I’m going to leave the default.
    ch5[161]
  4. Create a web part connection from the Current User Filter web part.  Choose to Send Filter values to, and then choose the consumer web part, which is the SharePoint list you want to filter.
    ch5[162]
  5. Pick the “Current Approver” or whatever field contains your user names, and click Finish, and exit edit mode.
    ch5[163]
  6. This is what the final, filtered view looks like:
    ch5[164]

In SharePoint 2010, you can safely remove the “Current Approver” column from the view if you don’t need to see it.  In SharePoint 2007, it won’t allow you to create a connection to a column that isn’t displayed in the view (unless the view is a data view web part).  Remember that this same thing can be done with other types of user name syntax, like the email address or full name.  Done!

If you’d like to learn more about how you can test to see what values are being passed from the Current User Filter web part, read my post: Testing the Current User Filter Web Part

 

Comments

Keith Hudson

Laura, do you know of any way to filter a view based on a property of the current logged in user, when you don't have the Current User Filter web part?  (ie, in WSS or Foundation?)
Shane YoungNo presence information on 3/25/2011 12:59 PM

Rene Modery

Shane YoungNo presence information on 3/29/2011 4:54 AM

Laura

Keith, No, it's  not possible out of box, but I would definitely take a look at Rene's solution there.
Laura RogersNo presence information on 4/21/2011 9:02 PM

Stefanie

This does not work for me in SP2007  Exception occurred. (Exception from HRESULT: 0x80020009 (DISP_E_EXCEPTION))  Troubleshoot issues with Windows SharePoint Services. 
Shane YoungNo presence information on 4/29/2011 3:26 PM

Group of Users

This is great.  I am using SP and Infopath 2010 and I have a list of appox. ten users.   I would like to filter based on the current user being in that list.  I am at my wits end.  I have a list of projects containing list of users an those users should have the abilty to automatically see their own projects.  Do you have any suggestions?  Thank you
Shane YoungNo presence information on 8/2/2011 6:15 AM

Laura

"group of users", Do you have the enterprise version?  If you only want a certain set of users to see the whole web part, you can set an audience in the web part settings. Then, you can use that in combination with my method with the current user filter. (If I understand the problem correctly)
Laura RogersNo presence information on 8/8/2011 5:31 PM

Thakhi

Hello Laura,
Great post! It worked for me on single line of text column(Domain\Account) ,but not working on email or full name etc?

any workaround for this?

Thanks
 on 3/10/2012 9:36 AM

Laura

Thakki,
You can just pick a different field at step 3.  See my other blog post for more info:
http://www.sharepoint911.com/blogs/laura/Lists/Posts/Post.aspx?ID=91
lauraNo presence information on 3/14/2012 10:39 PM
​I have disabled any new comments on this, because my blog has moved to a new site.  Please go here: http://www.wonderlaura.com
RSS FeedFacebookYouTube
 

 Our Books for End Users