I got this request from Carel Schotborgh:
Using WSS 3.0
Not have been able to find it anywhere so, since it is possible to filter a list items (in all event/task/etc view) based on membership in SharePoint group (By Alexander). I would like to request the possibility to filter an Agenda View on a single line text, based on a field of the current user information field (for instance department). I import data into SharePoint list what contains names of people. So users do not create the list items and there are multiple columns with names like Judge1 Judge2 Lawyer etc. As you all know you can’t use [ME] value in a single line text. This can only be used with columns: Created by, Modified by, Assigned to and People picking data. Problem with agenda view is also that it only displays 1 field (in general description of appointment for instance).
What do I want?
Filter (a) specific column(s) on the basis of the current user that is logged on (department field for example) in an agenda view.
The agenda should only show items that match the same text as entered in the department field of the user information field of the user that is currently logged on.
In my case IF Judge1 = Mr. J. Jenkins display it OR IF Judge2 = Mr. J. Jenkins display it. The OR statement is very important since SharePoint also filters with AND statement. So I would like to filter multiple columns with department field (any other also ok, as long I can fill in a value that is connected to the current user).
I already managed to create something that filters all event/tasks/etc list view, searching all the columns based upon the current user department field with or statement idea, but not specific columns. Also in agenda view my code and Alexanders code will not work.
If it is not possible to do this on each specific column it is also ok to search all of the columns since the names in my list are unique for each column. Other columns do not contain their names in such a way anyway. I’m already using my script for the not agenda view and works perfectly except user with slow internet will see the entire list my filter starts working.
Excuse me for long text, but it is complex. Much appreciated any help, suggestion or solution.
Here is one suggestion on how this can be done. It pulls the “Department” from the user profile and searches for a match in one of the fields specified in the script (in the variable “arrOfFieldInternalNames”).
This solution does:
- Filters a calendar view based on a text retrieved from the current users profile (from People and Groups)
- Filters with an “OR” statement looking for a match in multiple text fields
- Handles “single day items” and items spanning over multiple days.
- Hide the calendar view until it has been filtered
This solution doesn’t:
- If multiple elements are located in one day, the standard calendar view will display a “x more items” link to expand all items that day. My filter solution will filter the items, but may display a link saying there are “3 more items”, but when clicking the link there may no items to display.
To keep a nice even background when removing items spanning over multiple days, i had to change the background for the “not in this month items” to white.
Add this code to a CEWP below the calendar view:
Modify the parameters:
- listGuid: The list name or list Guid of the list to filter.
- listBaseUrl: The base URL of the list to filter.
- userListGuid: The list Guid of the user list (People and Groups).
- userListBaseUrl: The user list base URL – Most likely an empty string “”. If the site resides on a manage path this must be reflected.
- arrOfFieldInternalNames: Array of the FieldInternalNames to search for a match on the search string-
The jQuery-library is found here. The sourcecode refers to jquery-1.3.2.min.js. If you use another version, please update the reference in the code.
The scripts “interaction.js” and “stringBuffer.js” is created by Erucy and published on CodePlex.
I do not think this is a “production environment solution” at this stage, but please test it and post back any comments or suggestions and i will try to adapt the script.