Microsoft.Office.Server.Audience Namespace
How to target list items to a particular audience.
AudienceLoader audienceLoader = AudienceLoader.GetAudienceLoader();
foreach (SPListItem listItem in list.Items)
{
// Get roles the list item is targeted to.
string audienceFieldValue = (string)listItem[k_AudienceColumn];
// Quickly check if the user belongs to any of those roles.
if (AudienceManager.IsCurrentUserInAudienceOf(audienceLoader, audienceFieldValue, false))
{
// is a member
}
else
{
// not a member
}
}
Examples
Link
http://blogs.prexens.com/pages/category.aspx?Name=Audiences
Audience property
Once you filled-in target audience field , data are stored in "Audience" property of the underlying element (e.g. item, document, navigation node).
string audiencePropertyString = Convert.ToString(item.Properties["Audience"]);
Note that we use Convert.ToString() instead of .ToString() to avoid any null exception if the property does not exist.