Skip to content

CAML Queries, Part 3

June 24, 2010

Just some more CAML queries for your data-gathering pleasure. Even if you don’t use these specific ones (though you might), they might help you out in building your own. Be sure to check out all my posts on CAML, especially Creating Custom Reports with CAML to get you started.

All files created by or last modified by the current user:
Title it what you want, make a description, and leave CAML List Type empty unless you want to filter by data type. Read the entry I linked above to learn how to do that.

         <FieldRef Name="Editor" LookupId="TRUE"/>
         <Value Type="int">
         <FieldRef Name="Created" LookupId="TRUE"/>
         <Value Type="int">

All pages modified in the last 30 days, sorted by date modified, descending
Set CAML List Type to <Lists ServerTemplate='850' /> to limit the query to just Publishing Site Pages. Note the Ascending="False" syntax for descending sort order.

   <FieldRef Name="Modified" Ascending="False" />
      <FieldRef Name="Modified" />
      <Value Type="DateTime" IncludeTimeValue='TRUE'>
         <Today OffsetDays="-30" />

Unfortunately, it appears that Sharepoint can’t sort by a Choice field in a list, though (at least not out of the box).

One Comment leave one →
  1. paul permalink
    February 22, 2013 2:44 pm

    Can you tell me how I can show all documents that havent been modified in the last 30 days. Help would be much appreciated.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: