Friday, January 8, 2010

Filter by Person or Group Column Type

The Problem: I have a column called Attendees of the type "Person our Group." Furthermore, Attendees can contain multiple entries. When someone is viewing this view, I'd like them to be able to only see the items in which they are listed as an attendee.

When I try to filter by the criterion Attendees contains [Me] I get the following error:

"The filter type you selected cannot be used with this type of column. You can apply the 'contains' operator only to the columns that have the type Single line of text, Multiple lines of text, or Choice. Specify a different operator for the filter or change the column type. You can then attempt to create the filter again."

Lame!

To get around this, I use SharePoint Designer.

First, through the web interface I create the view that I want and filter on a random text column (e. g. randomTextColumnName contains [Me]). If I view the page now it'll say <!-- #RENDER FAILED -->. Whatever Microsoft.

To fix this, I now open the page for the view in the Designer and search for the internal name of my randomly chosen text column. When I get to the code that looks kind of like this:

...Contains&gt;&lt;FieldRef Name"TextColumnName"/&gt;&lt;...

(note that the quotation marks might read as &quot; - same difference for our purposes)
I can then change "TextColumnName" to the correct, internal name of the column (in my case, Attendees). Save and you're done.

Yeah. That's it. Silly, huh?

No comments:

Post a Comment