Share via


Query Property

The Query property of the SPQuery class gets or sets the inner XML used in the query.

Property Value

A string containing a fragment in Collaborative Application Markup Language (CAML) that defines the query.

Remarks

The Query property contains a string that corresponds to the inner XML of the Query element in CAML.

Example

The following code example uses the Query property to define a query that returns items whose Field2 values are greater than 1000.

This example requires using directives (Imports in Visual Basic) for the Microsoft.SharePoint, Microsoft.SharePoint.Utilities, and Microsoft.SharePoint.WebControls namespaces.

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security