AudienceManager.GetUserAudienceIDs Method (Boolean)
Gets a list of globally unique identifiers (GUIDs) for the audiences to which the current user belongs.
Namespace: Microsoft.Office.Server.Audience
Assembly: Microsoft.Office.Server.UserProfiles (in Microsoft.Office.Server.UserProfiles.dll)
Syntax
'Declaration
Public Function GetUserAudienceIDs ( _
needAudienceName As Boolean _
) As ArrayList
'Usage
Dim instance As AudienceManager
Dim needAudienceName As Boolean
Dim returnValue As ArrayList
returnValue = instance.GetUserAudienceIDs(needAudienceName)
public ArrayList GetUserAudienceIDs(
bool needAudienceName
)
Parameters
needAudienceName
Type: System.BooleanTrue if the AudienceName should be loaded, otherwise, false.
Return Value
Type: System.Collections.ArrayList
System.Collections.ArrayList object that represents a list of GUIDs for audiences to which the current user belongs.
Remarks
The GetUserAudienceIDs method identifies the current user by retrieving the security identifier (SID) for the current user from Microsoft Windows Server 2003. Account information such as Windows NT user name and domain are used to retrieve audience information from the database.
Examples
The following code example shows how to use the GetUserAudienceIDs method to retrieve and list GUIDs for audiences to which the current user belongs.
AudienceManager AudMgr = new AudienceManager();
ArrayList IDList = AudMgr.GetUserAudienceIDs();
System.Console.WriteLine("User Audience GUIDs");
for (int info=0; info<IDList.Count; info++)
{
System.Console.WriteLine(((Guid)IDList[info]).ToString());
}
Dim AudMgr As New AudienceManager()
Dim IDList As ArrayList = AudMgr.GetUserAudienceIDs()
System.Console.WriteLine("User Audience GUIDs")
For info As Integer = 0 To IDList.Count - 1
System.Console.WriteLine((CType(IDList(info), Guid)).ToString())
Next info