Omicron Llama

Coding all day, every day.

SharePoint QuickTip – Filtering by the current User in a Data View WebPart?


Displaying a DataViewWebPart of a List with a column of type “Person or Group”? Want to filter that list by the current user?


Dive into to Code View, locate the XSL Stylesheet and find the dvt_apos parameter declaration. Add in the UserID parameter just after it, so the 2 lines look like this:

Next, open up the Common DataView Tasks smart menu, and select Filter… open up the XSLT Filtering dialogue and add this:

Replace “@Owner” with the field in the list that contains the Person or Group. Save out, log in as another user and voilá!

You can also use the $UserID variable to display the current user’s Display Name somewhere on the page!

Leave a Reply

Your email address will not be published. Required fields are marked *