2

I have a list where I need to add Audience targeting.

I have added the site column Target Audiences to the list.

However, when I add any SharePoint group to the audience of a list item, it shows up as ;;;;GroupName in the list view.

Why does the ;;;; come up in the list view? I tried it on another publishing site, and had the same behavior.

1

This is the internal representation, the three types of values are separeted by ;;:

AudienceIds(Guids);;DistributionListsNames;;SharePointGroups

So when you have ;;;;GroupName it is just showing that there is nothing from the other types.

You can check more about that here: https://docs.microsoft.com/en-us/previous-versions/office/developer/sharepoint-2010/ee906649(v%3Doffice.14)#target-a-web-part-to-a-specific-audience-programmatically

Relevant part:

You can assign three kinds of audiences to the AuthorizationFilter property. To target a Web Part to a global audience programmatically, you can retrieve the GUID for the audience you want by using a AudienceManager object and then assigning that GUID to the AuthorizationFilter property of the Web Part. You can also assign the Lightweight Directory Access Protocol (LDAP) distinguished name of a distribution list or the name value of a SharePoint group to this property.

The SharePoint Server 2010 framework requires that these three kinds of values be separated by a pair of semicolons (";;"). Multiple values for global audiences and SharePoint groups are delimited by commas, and multiple values for distribution lists are delimited by newline characters ("\n"). The following example builds a string that would be valid for assignment to the AuthorizationFilter property.

string[] audienceIDs = new string[] {"GUID", "GUID"};
string[] distributionLists = new string[] 
{"LDAP Distinguished Distribution List Name", "LDAP Distinguished Distribution List Name"};
string[] sharePointGroups = new string[] {"SharePoint Group Name", "SharePoint Group Name"};

string result = string.Format("{0};;{1};;{2}",
string.Join(",", audienceIDs),
string.Join("\n", distributionLists),
string.Join(",", sharePointGroups));
| improve this answer | |
  • So if I add the Target Audience site column in a custom list, will the items be restricted to the respective audience? – rohinMVP Dec 4 '19 at 3:02
  • @rohinMVP No. To display the content of a List based on audiences, you need to use the Content Query Web part. In the properties of the Content Query Web Part you can specify to use the audiences to display the content (apply Audience Filtering). – Raf Dec 5 '19 at 6:06
  • @Raf Thanks. I found the info regarding the ContentQuery WebPart sometime back. Right now I am getting an error while trying to specify the list within the CQWP. – rohinMVP Dec 5 '19 at 6:10
  • @rohinMVP What is the error? – Raf Dec 5 '19 at 6:11
  • @Raf the error is same as sharepoint.stackexchange.com/q/76920/19613. Is there any work around, as it is an old SP application and I don't have the earlier code to fix the feature. – rohinMVP Dec 5 '19 at 6:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.