Share via


AudienceManager.GetAudience Method (Guid)

Gets an instance of the Audience object that represents the audience with the specified globally unique identifier (GUID).

Namespace:  Microsoft.Office.Server.Audience
Assembly:  Microsoft.Office.Server (in Microsoft.Office.Server.dll)

Syntax

'Declaration
Public Function GetAudience ( _
    AudienceID As Guid _
) As Audience
'Usage
Dim instance As AudienceManager
Dim AudienceID As Guid
Dim returnValue As Audience

returnValue = instance.GetAudience(AudienceID)
public Audience GetAudience(
    Guid AudienceID
)

Parameters

Return Value

Type: Microsoft.Office.Server.Audience.Audience
Audience object that represents the audience with the specified GUID. 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 viewable from within the current site.

Examples

The following code example shows how to get an Audience object by GUID and display basic information about that audience.

AudienceManager AudMgr = new AudienceManager();
Audience Aud = AudMgr.GetAudience(new Guid("00000000-0000-0000-0000-000000000001"));

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);

}

See Also

Reference

AudienceManager Class

AudienceManager Members

GetAudience Overload

Microsoft.Office.Server.Audience Namespace