AudienceManager.GetAudience AudienceManager.GetAudience AudienceManager.GetAudience Method

Definition

Overloads

GetAudience(Guid) GetAudience(Guid) GetAudience(Guid)

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

GetAudience(String) GetAudience(String) GetAudience(String)

Gets an instance of the Audience object that represents the audience with the specified name.

GetAudience(Guid) GetAudience(Guid) GetAudience(Guid)

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

public:
 Microsoft::Office::Server::Audience::Audience ^ GetAudience(Guid AudienceID);
public Microsoft.Office.Server.Audience.Audience GetAudience (Guid AudienceID);
Public Function GetAudience (AudienceID As Guid) As Audience
Parameters
AudienceID
Guid Guid Guid

GUID for an audience.

Returns

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.

Examples

<p>The following code example shows how to get an <xref data-throw-if-not-resolved="true" uid="Microsoft.Office.Server.Audience.Audience"></xref> object by GUID and display basic information about that audience.</p>
<pre><code>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);

}

Dim AudMgr As New AudienceManager()
Dim Aud As Audience = AudMgr.GetAudience(New Guid("00000000-0000-0000-0000-000000000001"))

If Aud IsNot Nothing Then
    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)

End If

Remarks

The GetAudience method provides a way to access an Audience object, assuming this audience is viewable from within the current site.

GetAudience(String) GetAudience(String) GetAudience(String)

Gets an instance of the Audience object that represents the audience with the specified name.

public:
 Microsoft::Office::Server::Audience::Audience ^ GetAudience(System::String ^ AudienceNameOrg);
public Microsoft.Office.Server.Audience.Audience GetAudience (string AudienceNameOrg);
Public Function GetAudience (AudienceNameOrg As String) As Audience
Parameters
AudienceNameOrg
String String String

Name of an audience.

Returns

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.

Examples

<p>The following code example shows how to get an <xref data-throw-if-not-resolved="true" uid="Microsoft.Office.Server.Audience.Audience"></xref> object by name and display basic information about that audience.</p>
<pre><code>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);

}

Dim AudMgr As New AudienceManager()
Dim Aud As Audience = AudMgr.GetAudience("Audience Name")

If Aud IsNot Nothing Then
    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)

End If

Remarks

The GetAudience method provides a way to access an Audience object, assuming this audience is displayed within the current site.

Applies to