Share via


AudienceManager.GetUserAudienceIDs Method (String, Boolean, SPWeb)

Gets a list of audience globally unique identifiers (GUIDs) for the specified user name.

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

Syntax

'Declaration
Public Function GetUserAudienceIDs ( _
    accountName As String, _
    needAudienceName As Boolean, _
    web As SPWeb _
) As ArrayList
'Usage
Dim instance As AudienceManager
Dim accountName As String
Dim needAudienceName As Boolean
Dim web As SPWeb
Dim returnValue As ArrayList

returnValue = instance.GetUserAudienceIDs(accountName, _
    needAudienceName, web)
public ArrayList GetUserAudienceIDs(
    string accountName,
    bool needAudienceName,
    SPWeb web
)

Parameters

  • accountName
    Type: System.String
    Windows NT account name of a user. Contains both the domain and the user name. For example, Domain\user_name.

Return Value

Type: System.Collections.ArrayList
System.Collections.ArrayList object that represents a list of GUIDs for audiences for the specified user name.

Remarks

The GetUserAudienceIDs method retrieves account information for the user with the specified Windows NT user name. Account information such as 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 the audiences to which the specified user belongs.

AudienceManager AudMgr = new AudienceManager();
ArrayList IDList = AudMgr.GetUserAudienceIDs("DomainName\user_name");
System.Console.WriteLine("User Audience GUIDs");

for (int info=0; info<IDList.Count; info++)
{
    System.Console.WriteLine(((Guid)IDList[info]).ToString());
}

See Also

Reference

AudienceManager Class

AudienceManager Members

GetUserAudienceIDs Overload

Microsoft.Office.Server.Audience Namespace