• Filter a View by “Me” Without a People Column


    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

  • 相关阅读:
    如何提高IT团队的执行力?
    Internet Explorer 安全区域注册表项说明
    用C#编写ActiveX控件(一) 转载
    用C#编写ActiveX控件(二) 转载
    关于《用C#编写ActiveX控件》的几点说明 转载
    【经典】单调栈+离线+线段树区间更新——求所有子区间gcd之和 icpc cerc 2019 b
    SQL语句
    Windows 程序设计学习记录(1)类的定义和应用
    Windows 程序设计学习记录(2)数据链表删除,增加的算法
    推荐一些博客网站
  • 原文地址:https://www.cnblogs.com/ahghy/p/3068322.html
Copyright © 2020-2023  润新知