Click to Rate and Give Feedback
Microsoft.Office.Server.Audience Namespace
Contains classes that create Audiences and target data to a specific Audience.

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

NoteNote:

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

In SharePoint Portal Server 2003, the Microsoft.SharePoint.Portal.Audience namespace is used to work with audiences. In Office SharePoint Server 2007, the Audience object model is implemented in the Microsoft.Office.Server.Audience namespace in Microsoft.Office.Server.dll. This new namespace provides object model support for the new functionality in Office SharePoint Server 2007.

The Microsoft.SharePoint.Portal.Audience namespace still exists for backward compatibility. Your applications and tools written in SharePoint Portal Server 2003 using the Microsoft.SharePoint.Portal.Audience namespace should still work in Office SharePoint Server 2007. However, note that they may not behave as expected, specifically with the new features. For example, if you use the APIs in Microsoft.SharePoint.Portal.Audience, you can only work with rules-based audiences. Therefore, if you are writing new applications or upgrading old applications, you should use the new Microsoft.Office.Server.Audience namespace in Microsoft.Office.Server.dll. All the classes in the Microsoft.SharePoint.Portal.Audience namespace have been deprecated, and you will get a warning every time you use a class or method in the Microsoft.SharePoint.Portal.Audience namespace.

The AudienceManager object is the top-level object in the Audience object model. You can get an AudienceManager object in Office SharePoint Server 2007 by using the syntax shown in the following code example. Replace servername with an actual value and add any code that you might need before using this example.

C#
using (SPSite site = new SPSite("http://servername"))
 {
   ServerContext context = ServerContext.GetContext(site);
   AudienceManager audManager = new AudienceManager(context);
   //your code here
 }

The following code example shows how to target list items to a particular audience.

C#
    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
                }
  }
 ClassDescription
Public classAudience Represents an audience on a Microsoft Office SharePoint Server 2007 site.
Public classAudienceAccountNameNotResolvedException 
Public classAudienceADImportException Represents the exception thrown when an error occurs while getting data from Microsoft Active Directory directory service.
Public classAudienceArgumentException Represents the exception thrown when invalid data is supplied to the AudienceCollection and AudienceSiteCollection classes.
Public classAudienceCollection The AudienceCollection class represents a collection of audiences for a portal site.
Public classAudienceCollection.AudienceEnumerator Represents the enumerator for Audience objects in the AudienceCollection object.
Public classAudienceConnectionException Represents the exception thrown when an error occurs when connecting to the database.
Public classAudienceDataValueOutOfRangeException Represents an exception thrown when a data value is out of range.
Public classAudienceDataWrongFormatException 
Public classAudienceDuplicateNameException Represents the exception thrown when a user tries to create or rename an audience to a name that already exists in the database.
Public classAudienceException Represents the base class for audience exceptions.
Public classAudienceExecutionException Represents the exception thrown when an error occurs when executing an audience operation, such as creating, removing, or updating an audience.
Public classAudienceGroupOperationException Represents an exception thrown when an error is encountered in the audience while performing a group operation.
Public classAudienceInCompilationException Throws an exception when a user tries to change audience data while audience rules are compiling.
Public classAudienceJob Provides a method to start and stop full and incremental audience compilations
Public classAudienceLeftContent Represents the operand content of an audience rule.
Public classAudienceManager Represents the entry point for the audience classes.
Public classAudienceNameDescriptionLengthException Represents an exception thrown when the length of the audience name exceeds 50 characters or if the description exceeds 254 characters.
Public classAudienceNameID Represents a synopsis of information about an audience, such as name, globally unique identifier (GUID), and whether the audience is still valid.
Public classAudienceNoContentException Represents an exception thrown by the AudienceManager object when an error is encountered while retrieving data.
Public classAudienceNotExistException Implements the exception thrown when an audience cannot be found in the database.
Public classAudienceOperator Represents the definition of an audience operator.
Public classAudienceOperatorException Represents the exception thrown by the Audience class and AudienceManager class when an operator error is encountered for a rule definition.
Public classAudienceOwnerAccountNameLengthException Represents an exception thrown when the length of the owner account name exceeds 400 characters.
Public classAudienceRuleComponent Represents one rule in an audience.
Public classAudienceRuleLeftContentException Represents the exception thrown when an error is encountered in the operand portion of an audience rule.
Public classAudienceRuleRightContentException Represents the exception thrown by the AudienceRuleComponent class when an error in encountered in the rule definition.
Public classAudienceSite Represents an entry point for accessing the audience associated with a portal site.
Public classAudienceSiteCollection Represents a collection of portal sites associated with a specific audience.
Public classAudienceSiteCollection.AudienceSiteEnumerator Enumerates sites in the AudienceSiteCollection class.
Public classAudienceSiteInfo Represents information for a specific instance of the AudienceSite class in addition to the Microsoft.Office.Server.ServerContext object associated with the portal site.
Public classAudienceWrongAccountNameFormatException Represents the exception that is thrown when the wrong account name format is encountered in an audience rule.
Public classEmptyToolPaneControl This class and its members are reserved for internal use and are not intended to be used in your code.
Public classMembershipInfo Stores information from Microsoft Active Directory directory service about a user or group.
Public classUserInfo Represents user information from a user's user profile, such as e-mail address and name.
 EnumerationDescription
Public enumerationAudienceAccessRights Represents the access rights one can have on audiences.
Public enumerationAudienceGroupOperation Specifies the operations that can be performed on an audience that has more than one rule.
Public enumerationAudienceJobReturnCode Indicates the status of the RunAudienceJob method call.
Public enumerationAudienceType Represents the type of the audience.
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker