WqlEventQuery.GroupByPropertyList Property

 

Gets or sets properties in the event to be used for grouping events of the same type.

Namespace:   System.Management
Assembly:  System.Management (in System.Management.dll)

public StringCollection GroupByPropertyList { get; set; }

Property Value

Type: System.Collections.Specialized.StringCollection

Returns a StringCollection containing the properties in the event to be used for grouping events of the same type.

Setting this property value overrides any previous value stored in the object. The query string is rebuilt to reflect the new grouping.

Null, if no grouping is required; otherwise, a collection of event property names.

Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.

The following example initializes a new WqlEventQuery and displays the event query string.

using System;
using System.Management;

public class EventSample 
{
    public static void Main(string[] args) 
    {
        WqlEventQuery query = new WqlEventQuery();
        query.EventClassName = "__InstanceCreationEvent";
        query.Condition = "TargetInstance ISA 'Win32_NTLogEvent'";
        query.GroupWithinInterval = new TimeSpan(0, 0, 10);
        System.Collections.Specialized.StringCollection collection =
            new System.Collections.Specialized.StringCollection();
        collection.Add("TargetInstance.SourceName");
        query.GroupByPropertyList = collection;
        query.HavingCondition = "NumberOfEvents > 25";

        Console.WriteLine(query.QueryString);
        return;
    }
}

.NET Framework
Available since 1.1
Return to top
Show: