Condividi tramite


AudienceManager.GetAudienceNames Method

Gets a list of AudienceNameID objects that correspond to the specified list of audience globally unique identifiers (GUIDs).

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

Syntax

'Declaration
Public Function GetAudienceNames ( _
    AudienceIDList As ArrayList _
) As ArrayList
'Usage
Dim instance As AudienceManager
Dim AudienceIDList As ArrayList
Dim returnValue As ArrayList

returnValue = instance.GetAudienceNames(AudienceIDList)
public ArrayList GetAudienceNames(
    ArrayList AudienceIDList
)

Parameters

Return Value

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

Remarks

The GetAudienceNames method retrieves a list of AudienceNameID objects that correspond to the list of audience GUIDs specified in AudienceIDList.

Examples

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

ArrayList AudienceIDList = new ArrayList();
ArrayList AudienceNameList;
AudienceIDList.Add(new Guid("00000000-0000-0000-0000-000000000000"));
AudienceIDList.Add(new Guid("53581B32-8A7A-430E-893C-157B40BF41FF"));

AudienceNameList = AudMgr.GetAudienceNames(AudienceIDList);

if (AudienceNameList != null)
{
    for (int i=0; i < AudienceNameList.Count; i++)
    {
        System.Console.WriteLine("{0}", i);
        System.Console.WriteLine(((AudienceNameID)AudienceNameList[i]).AudienceID);
        System.Console.WriteLine(((AudienceNameID)AudienceNameList[i]).AudienceName);
        System.Console.WriteLine(((AudienceNameID)AudienceNameList[i]).bValid);
    }
}
Dim AudienceIDList As New ArrayList()
Dim AudienceNameList As ArrayList
AudienceIDList.Add(New Guid("00000000-0000-0000-0000-000000000000"))
AudienceIDList.Add(New Guid("53581B32-8A7A-430E-893C-157B40BF41FF"))

AudienceNameList = AudMgr.GetAudienceNames(AudienceIDList)

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

See Also

Reference

AudienceManager Class

AudienceManager Members

Microsoft.Office.Server.Audience Namespace