So, I have been working on a project for a customer who wanted to Target Audience individual list items in SharePoint... Simple task, right?

I allowed the management of content types on my list and added in the ‘Target Audience’ site column which is available to us out of the box.  This bit all works fine.

The actual problem arises when you start to audience target the list items. When you audience target list items, the audience appears as a GUID in the list view (as below).


But if you remove the audience from the first list item, the audience does not appear as a GUID (as below).



So basically, if the first item in the list has an audience, then ALL the items appear as GUIDS. As soon as you remove the audience from the first list item, the audience name loads correctly i.e. doesn't display the GUID.

I did a bit of further reading on this and a lot of people have said this issue is by design, but surely it can’t be a design issue? No one wants to see a GUID in the view.

I found this issue is evident on all on-premise versions of SharePoint (2007, 2010 and 2013) and SharePoint Online. Having contacted Microsoft about the issue; they confirmed that this issue is a Bug in SharePoint and it has been there since 2007.


Microsoft reasoning

“This bug will not be fixed. SharePoint uses XSLT stylesheets to render list views. A list is rendered as an HTML table and the value of a field is rendered into the appropriate cell of the table by a simple XSLT template from the fldtypes.xsl file located in %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\LAYOUTS\XSL. And this issue relates to the .xsl file.”

So there you have it folks, an unfixable bug in SharePoint. The current workaround is to remove the audience from the first item. I didn’t find this very appealing, nor a solution, so I had a little play around with it and have found a temporary fix which works for me.


Temporary Fix to Audiences appearing as GUID

As the GUID on Target Audiences only appears on the first item in the list, we need to find a way of hiding the first item. Having tried to use filters on the view to hide the first ID – the problem still remained, (because the first item in the list will be item 2 If you hide item 1).


A solution that has worked for me was adding the snippet web part to the actual list and then adding a bit of code to it. See below:


1. Create a bogus item as the first item in the list. Make sure that this item has an ID of 1 (so it has to be the first item in the list).



2. Edit the list by selecting the cog in the corner and Edit Page


3. Insert the snippet web part on top of the list and insert the following code:

.ms-listviewtable > tbody > tr:first-child{
   display: none;

4. Save the page


5. Voila!



The snippet is just basically hiding the first item in the list.


*I strongly recommend you try and test this before you insert any code onto a PROD environment.

Author bio

Vishan Sondhi
SharePoint Consultant
Vishan is a SharePoint Consultant


comments powered by Disqus

Related Articles

Sign up to our ClearThought newsletter

Get inspired and learn something new by subscribing to our FREE newsletter. It’s full of ClearPeople's thought-leadership whitepapers, blogs, events, and much more. We promise to not use your email for spam.

Closing this message and/or accessing our website tells us you are happy to receive all cookies on the ClearPeople website.
However, if you would like to, you can change your cookies settings at any time.