Partilhar via


AudienceManager.GetAudienceIDs Method

NOTE: This API is now obsolete.

Gets a list of AudienceNameID objects that correspond to the specified list of audience names.

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

Syntax

'Declaration
<ObsoleteAttribute("Use GetAudience(string AudienceNameOrg) to retrieve Audience.AudienceID instead")> _
Public Function GetAudienceIDs ( _
    AudienceNameList As ArrayList _
) As ArrayList
'Usage
Dim instance As AudienceManager
Dim AudienceNameList As ArrayList
Dim returnValue As ArrayList

returnValue = instance.GetAudienceIDs(AudienceNameList)
[ObsoleteAttribute("Use GetAudience(string AudienceNameOrg) to retrieve Audience.AudienceID instead")]
public ArrayList GetAudienceIDs(
    ArrayList AudienceNameList
)

Parameters

Return Value

Type: System.Collections.ArrayList
System.Collections.ArrayList object that represents a list of AudienceNameID objects.

Remarks

The GetAudienceIDs method retrieves an AudienceNameID object that corresponds to the list of audience names specified in AudienceNameList.

Examples

The following code example shows how to build an ArrayList of audience names and invoke the GetAudienceIDs method.

ArrayList AudienceIDList;
ArrayList AudienceNamelist = new ArrayList();
AudienceNamelist.Add("All");
AudienceIDList = AudMgr.GetAudienceIDs(AudienceNamelist);

if (AudienceIDList != null)
{
    for (int i=0; i < AudienceIDList.Count; i++)
    {
        System.Console.WriteLine("{0}", i);
        System.Console.WriteLine(((AudienceNameID)AudienceIDList[i]).AudienceID);
        System.Console.WriteLine(((AudienceNameID)AudienceIDList[i]).AudienceName);
        System.Console.WriteLine(((AudienceNameID)AudienceIDList[i]).bValid);
    }
}
Dim AudienceIDList As ArrayList
Dim AudienceNamelist As New ArrayList()
AudienceNamelist.Add("All")
AudienceIDList = AudMgr.GetAudienceIDs(AudienceNamelist)

If AudienceIDList IsNot Nothing Then
    For i As Integer = 0 To AudienceIDList.Count - 1
        System.Console.WriteLine("{0}", i)
        System.Console.WriteLine((CType(AudienceIDList(i), AudienceNameID)).AudienceID)
        System.Console.WriteLine((CType(AudienceIDList(i), AudienceNameID)).AudienceName)
        System.Console.WriteLine((CType(AudienceIDList(i), AudienceNameID)).bValid)
    Next i
End If

See Also

Reference

AudienceManager Class

AudienceManager Members

Microsoft.Office.Server.Audience Namespace