AudienceManager.GetAudience Method (String)
Gets an instance of the Audience object that represents the audience with the specified name.
Namespace: Microsoft.Office.Server.Audience
Assembly: Microsoft.Office.Server (in Microsoft.Office.Server.dll)
Syntax
'Declaration
Public Function GetAudience ( _
AudienceNameOrg As String _
) As Audience
'Usage
Dim instance As AudienceManager
Dim AudienceNameOrg As String
Dim returnValue As Audience
returnValue = instance.GetAudience(AudienceNameOrg)
public Audience GetAudience(
string AudienceNameOrg
)
Parameters
- AudienceNameOrg
Type: System.String
Name of an audience.
Return Value
Type: Microsoft.Office.Server.Audience.Audience
Audience object that represents the audience with the specified name. Otherwise, a null reference (Nothing in Visual Basic) if the audience was not found or cannot be displayed within the current site.
Remarks
The GetAudience method provides a way to access an Audience object, assuming this audience is displayed within the current site.
Examples
The following code example shows how to get an Audience object by name and display basic information about that audience.
AudienceManager AudMgr = new AudienceManager();
Audience Aud = AudMgr.GetAudience("Audience Name");
if (Aud != null)
{
System.Console.WriteLine("Audience.Name {0}", Aud.AudienceName);
System.Console.WriteLine("Audience.AudienceDescription {0}", Aud.AudienceDescription);
System.Console.WriteLine("Audience.AudienceID {0}", Audi.AudienceID.ToString());
System.Console.WriteLine("Audience.AudienceSite {0}", Aud.AudienceSite);
}