Filtering a view based on Audience Targeting

So you’ve tried the fancy Audience Targeting (AT) feature in MOSS. You probably realized it’s just this || close to useless unless you want to use that “AMAZING” content query web part. What if you want your custom view to be filtered for the user’s audience? This solution doesn’t cover all scenarios but it goes far.

What is needed:
SPD, your view needs to be converted to XSLT, and you need an audience.

What are we trying to do:
you have a doc lib with AT turned on, and you have individual docs with audiences specified. you want to show the right audience the right docs.
but you realize that this isn’t working.

What you need to do:
Create a page with two views to your doc lib.
Convert them to XSLT.
Build a basic filter in the first one (Title contains “something”) use “contains”
The Data Query is created in the XSL, where you can edit it.

In the first view: (showing just the docs for the target audience)
In the code, search for: Name="Title"
Replace the word Title with Target_x0020_Audiences
In the code search for: Type="Text">something<
replace the word something with the exact name of your Target Audience (don’t replace the spaces with _x0200_)
right click the first view in SPD and go to web part properties > advanced
specify the audience that should see only the docs targeted at it
This view will be shown to that audience only

In the second view: (showing all docs)
right click it in SPD and go to web part properties > advanced
specify the audience that should see everything
This view will be shown to that audience only

Done

Save, browse and enjoy the hack!

Leave a Comment

Your email is never published nor shared.

(required)
(required)