AudienceManager.GetUserAudienceIDs AudienceManager.GetUserAudienceIDs AudienceManager.GetUserAudienceIDs Method

Definition

Overloads

GetUserAudienceIDs(Boolean) GetUserAudienceIDs(Boolean) GetUserAudienceIDs(Boolean)

Gets a list of globally unique identifiers (GUIDs) for the audiences to which the current user belongs.

GetUserAudienceIDs(String, Boolean, SPWeb) GetUserAudienceIDs(String, Boolean, SPWeb) GetUserAudienceIDs(String, Boolean, SPWeb)

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

GetUserAudienceIDs(Boolean) GetUserAudienceIDs(Boolean) GetUserAudienceIDs(Boolean)

Gets a list of globally unique identifiers (GUIDs) for the audiences to which the current user belongs.

public:
 System::Collections::ArrayList ^ GetUserAudienceIDs(bool needAudienceName);
public System.Collections.ArrayList GetUserAudienceIDs (bool needAudienceName);
Public Function GetUserAudienceIDs (needAudienceName As Boolean) As ArrayList
Parameters
needAudienceName
Boolean Boolean Boolean

True if the AudienceName should be loaded, otherwise, false.

Returns

System.Collections.ArrayList object that represents a list of GUIDs for audiences to which the current user belongs.

Examples

<p>The following code example shows how to use the <strong>GetUserAudienceIDs</strong> method to retrieve and list GUIDs for audiences to which the current user belongs.</p>
<pre><code>AudienceManager AudMgr = new AudienceManager();

ArrayList IDList = AudMgr.GetUserAudienceIDs(); System.Console.WriteLine("User Audience GUIDs");

for (int info=0; info&lt;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

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.

GetUserAudienceIDs(String, Boolean, SPWeb) GetUserAudienceIDs(String, Boolean, SPWeb) GetUserAudienceIDs(String, Boolean, SPWeb)

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

public:
 System::Collections::ArrayList ^ GetUserAudienceIDs(System::String ^ accountName, bool needAudienceName, Microsoft::SharePoint::SPWeb ^ web);
public System.Collections.ArrayList GetUserAudienceIDs (string accountName, bool needAudienceName, Microsoft.SharePoint.SPWeb web);
Public Function GetUserAudienceIDs (accountName As String, needAudienceName As Boolean, web As SPWeb) As ArrayList
Parameters
accountName
String String String

Microsoft Windows NT account name of a user. Contains both the domain and the user name. For example, Domain\user_name.

needAudienceName
Boolean Boolean Boolean

True if the AudienceName should be loaded, otherwise, false.

web
SPWeb SPWeb SPWeb

A SPWeb object.

Returns

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

Examples

<p>The following code example shows how to use the <strong>GetUserAudienceIDs</strong> method to retrieve and list GUIDs for the audiences to which the specified user belongs.</p>
<pre><code>AudienceManager AudMgr = new AudienceManager();

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

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

Dim AudMgr As New AudienceManager()
Dim IDList As ArrayList = AudMgr.GetUserAudienceIDs("DomainName\\user_name")
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

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.

Applies to