Partilhar via


AudienceManager.Audiences Property

Gets the collection of Audience objects for the current site.

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

Syntax

'Declaration
Public ReadOnly Property Audiences As AudienceCollection
    Get
'Usage
Dim instance As AudienceManager
Dim value As AudienceCollection

value = instance.Audiences
public AudienceCollection Audiences { get; }

Property Value

Type: Microsoft.Office.Server.Audience.AudienceCollection
AudienceCollection collection of Audience objects that are associated with the current site.

Remarks

The Audiences property is read-only. This property does not require the user to be a member of the Administrator site group for Microsoft Office SharePoint Server 2007.

Examples

The following code example shows how to retrieve and list information for audiences associated with a site.

AudienceCollection Audiences;
AudienceManager AudMgr = New AudienceManager();
Audiences = AudMgr.Audiences;

for (int list=0; list < Audiences.Count; list++)
{
    System.Console.WriteLine("{0}", list);
    Audience = (Audience)Audiences[list];
    System.Console.WriteLine("  Audience.Count ", Audience.Count);
    System.Console.WriteLine("  Audience.AudienceCompiledSofar ", Audience.AudienceCompiledSofar);
    System.Console.WriteLine("  Audience.LastCompileStartTime ", Audience.LastCompileStartTime);
    System.Console.WriteLine("  Audience.LastCompileStartTime ", Audience.LastCompileFinishTime);
    System.Console.WriteLine("  Audience.LastCompileError ", Audience.LastCompileError);
    System.Console.WriteLine("  Audience.CompileInProgress ", Audience.CompileInProgress);
}
System.Console.WriteLine("End");
Dim Audiences As AudienceCollection
Dim AudMgr As New AudienceManager()
Audiences = AudMgr.Audiences

For list As Integer = 0 To Audiences.Count - 1
    System.Console.WriteLine("{0}", list)
    Audience = CType(Audiences(list), Audience)
    System.Console.WriteLine("  Audience.Count ", Audience.Count)
    System.Console.WriteLine("  Audience.AudienceCompiledSofar ", Audience.AudienceCompiledSofar)
    System.Console.WriteLine("  Audience.LastCompileStartTime ", Audience.LastCompileStartTime)
    System.Console.WriteLine("  Audience.LastCompileStartTime ", Audience.LastCompileFinishTime)
    System.Console.WriteLine("  Audience.LastCompileError ", Audience.LastCompileError)
    System.Console.WriteLine("  Audience.CompileInProgress ", Audience.CompileInProgress)
Next list
System.Console.WriteLine("End")

See Also

Reference

AudienceManager Class

AudienceManager Members

Microsoft.Office.Server.Audience Namespace