U2U Caml Query Builder (Windows version): new version

This version includes the following updates:

- Query fields by ID

- GetListItemChanges (method of the Lists.asmx web service)

- GetListItemChangesSinceToken (method of the Lists.asmx web service)

- extra options of the QueryOptions part

- support for data type ModStat 

You can download the version 3.1.0.0 here.

Remark for those who have put the dlls in the GAC: the version of U2U.SharePoint.CAML.dll has NOT been augmented so the users of the feature version are not bothered. The versions of U2U.SharePoint.CAML.Client.dll and U2U.SharePoint.CAML.Server.dll have also been raised to version 3.1.0.0 because of the changes. So users who use these dlls for custom development will have to check. But as I didn't remove any method, no interfaces should be broken.

Query fields by ID

In most of the cases list items are retrieved using the <FieldRef Name="x" /> syntax. But there are cases that you need to query by ID. In that case you can set the Query by ID option in the upper right corner of the form.

camlv2querybyid

Your query will look like the following:

camlv2querybyid2

Keep in mind that when you already built a query the default way and then choose to build the query by ID, your query will be cleared and you will have to start over again.

The ModStat data type

In case a column in your list is of data type ModStat, a combo box with the values Approved, Pending and Rejected will be displayed. A query containing such a field will look as follows:

<Where>
      <Eq>
         <FieldRef Name="_ModerationStatus" />
         <Value Type="ModStat">Approved</Value>
      </Eq>
</Where>

GetListItemChanges

With this method you can retrieve items that have been modified since a certain date. If you pass no date, all list items will be returned.

For a more in-depth explanation of this method I refer to:

- http://msdn2.microsoft.com/en-us/library/lists.lists.getlistitemchanges.aspx

To build a CAML query for the GetListItemChanges, open your site using the web service mode:

camlv2connectws

Right-click the list for which you want to build a query from the treeview at the left and choose GetListItemChanges:

camlv2getlistitemchanges1

You get 3 tabs to build your query:

- the ViewFields tab as in the GetListItems method

- the Contains tab where you can define a sort of filter

- the Since tab to specify a date

image

If you want to specify a date from which changed rows must be returned, check the Retrieve changes as of check box and choose a date from the date picker. In case you also need to specify a time, use the up/down controls. The date will be passed to the GetListItemChanges method.

GetListItemChangesSinceToken

With this method you can retrieve  list items that have been changed. On the first run of the method, the server returns all rows and a token. In the next runs you pass this token back to the server and only the modified rows since that token will be returned.

For a more in-depth explanation of this method I refer to:

- http://blogs.msdn.com/sharepointdeveloperdocs/archive/2008/01/21/synchronizing-with-windows-sharepoint-services-part-1.aspx

- http://msdn2.microsoft.com/en-us/library/lists.lists.getlistitemchangessincetoken.aspx

To build a CAML query for the GetListItemChangesSinceToken, open your site using the web service mode. Right-click the list for which you want to build a query from the treeview at the left and choose GetListItemChangesSinceToken.

You get 5 tabs to build your query:

- the ViewFields tab as in the GetListItems method

- the Query tab as in the GetListItems method where you can define a more complex filter and a sort order

- the Contains tab where you can define a sort of filter

- the ChangeToken tab to specify a token returned by the server

The Query tab and the Contains tab are mutually exclusive. This means that you can build a (more complex) filter with a WHERE clause or a simple CONTAINS filter.

image

The set of query options is a bit more extended for this method.

image

Don't forget, if you want to use the methods GetListItemChanges and GetListItemChangesSinceToken you can use the CAML generated by this tool but you can also use the underlying dlls U2U.SharePoint.CAML.dll and the U2U.SharePoint.CAML.Client.dll. If this is your case, don't hesitate to ask for a code sample!