SPChangeQuery Constructor

Initializes a new instance of the SPChangeQuery class.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Sub New ( _
    AllChangeObjectTypes As Boolean, _
    AllChangeTypes As Boolean _
)
'Usage
Dim AllChangeObjectTypes As Boolean
Dim AllChangeTypes As Boolean

Dim instance As New SPChangeQuery(AllChangeObjectTypes, _
    AllChangeTypes)
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.

Remarks

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.
Dim query As New SPChangeQuery(False, True)

' object type 
query.Group = True
// 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.
Dim query As New SPChangeQuery(True, False)

' change type. 
query.Delete = True
// 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.
Dim query As New SPChangeQuery(False, False)

' object types.
query.User
query.Group

' change types. 
query.Add = True
query.Delete = True
query.Update = True
query.GroupMembershipAdd = True
query.GroupMembershipDelete = True
// 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;

See Also

Reference

SPChangeQuery Class

SPChangeQuery Members

Microsoft.SharePoint Namespace