Audiences Overview

Audiences are groups of users determined by their memberships in Microsoft Exchange distribution lists (DL) or SharePoint groups, or by rules configured by a portal administrator. For example, you could set up new employees, executives, salespeople, or people from Redmond as audiences. In Microsoft Office SharePoint Server 2007, the audience rules can be based on information in the user profile, on membership in an Active Directory directory service security group or an Exchange distribution list, or on the organization’s reporting structure (if this information is kept in Active Directory).

Audiences allow organizations to target content to users based on their job or task, as defined by their membership in a SharePoint group or distribution list, by the organizational reporting structure, or by the public properties in their user profiles.

Microsoft Office SharePoint Portal Server 2003 only supported rules-based compiled audiences. Office SharePoint Server 2007 supports targeting based on audience, SharePoint groups, and DL memberships. In addition, Office SharePoint Server 2007 provides the ability to target to the list item level, rather than just to the list level.

Note

Office SharePoint Server 2007 also provides a Web service that finds all the Office SharePoint Server 2007 sites that are targeted to a particular user. For more information, see How to: Use the Published Links Web Service.

Targeting Content

You can target Web Part content in three different ways. First, you can target Web Parts so that members of different audiences see different Web Parts on a page. Next, by using Web Parts that recognize audience membership, you can target items or links in a list to one or more audiences, so that only members of those audiences can view the targeted items within the Web Parts. For example, in a default area called Human Resources, a site administrator or the manager of that area could add a news item within the News Web Part. This item could be targeted to an audience composed of all new employees, directing them to the New Employee Benefits site. Finally, you can target navigation controls to different audiences.

Managing Audiences and Rules

Global audiences and DLs are managed centrally across one or more server farms hosting Office SharePoint Server 2007. They apply across one or more portals in a deployment, but not to individual areas, sites, or items. You must have the "Manage Audiences" right to manage rules-based audiences. As an audience manager, you can view all members of a specific audience, as well as manage the rules defining audiences, and you can compile audiences as the rules and members of an audience change.

Note

You can use audiences based on memberships in Microsoft Exchange distribution lists (DL) and SharePoint groups directly without compilation. Only rules-based audiences need compilation.

You can use DLs and SharePoint groups directly . To use rules-based audiences effectively, you must first create an audience and the rules that determine which users are members of that audience. You must then target an item, such as a document or news item, to one or more audiences. Finally, you need to store the targeted item in a list that uses a Targeted Content Web Part to display items to users of the portal site.

Note

Audiences are not used to assign rights and permissions. Office SharePoint Server 2007 uses site groups to assign rights and permissions to users within the portal. Audiences are used to manage how content is distributed, not to enforce security. They push information to a user; they do not restrict or permit access to information.

Audiences are also contained in the user profile store, but they are contained in a separate table from the one that contains user profiles. Creating an audience involves creating rules and then compiling the audience. Rules define which user accounts should be included or excluded from the audience. Rules created for an audience also are stored in a separate table in the user profile store.

When an audience is compiled, the rules are used as a filter against the complete list of user profiles. Because not all account information is imported into the user profile database, Active Directory is also queried during an audience compilation. Accounts that fit the rule are copied and placed in a separate table that holds the members of the audience. This table contains the members of all audiences for a portal and is separate from the table that stores the rules. The table that contains audience members is not updated; it remains static until the audience is recompiled.

Using Audiences to Target List Items

The following code example shows 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
                }
            }

See Also

Concepts

Audience Object Model Overview

Other Resources

Targeting Content Using Audiences