SPChangeQuery constructor

Initializes a new instance of the SPChangeQuery class.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public SPChangeQuery(
	bool AllChangeObjectTypes,
	bool AllChangeTypes
)

Parameters

AllChangeObjectTypes
Type: System.Boolean

true to return changes to all object types; otherwise, false. If false, changes are returned only for object types that have an SPChangeQuery object type property that is set to true.

AllChangeTypes
Type: System.Boolean

true to return all types of changes; otherwise, false. If false, changes are returned only for change types that have an SPChangeQuery property that is set to true.

You can filter the results that are returned by a call to the GetChanges(SPChangeQuery) method of an SPList, SPWeb, SPSite, or SPContentDatabase object by using the two parameters of the SPChangeQuery constructor in combination with the SPChangeQuery object properties. For example, the following code constructs a query for all types of changes to one type of object.

// Construct a query.
SPChangeQuery query = new SPChangeQuery(false, true); 

// object type. 
query.Group = true;

In contrast, the next code example constructs a query for one type of change to all object types.

// Construct a query.
SPChangeQuery query = new SPChangeQuery(true, false); 

// change type. 
query.Delete = true;

Or, you can constrain both parameters by setting both to false. For example, the following code constructs a query for certain changes to only two object types.

// Construct a query.
SPChangeQuery query = new SPChangeQuery(false, false); 

// object types.
query.User = true;
query.Group = true;

// change types. 
query.Add = true;
query.Delete = true;
query.Update = true;
query.GroupMembershipAdd = true;
query.GroupMembershipDelete = true;
Show: