You can use a SPSiteDataQuery to query multiple lists (within your site structure) and filter based on Content Type. Something like this: <Where> <Eq> <FieldRef Name='ContentType'/> <Value Type='Computed'>YourCustomContentTypeName</Value> </Eq> </Where> Tip: Download CAML Designer which will assist you ...


Try ContentTypeId in the CAMLQuery: <BeginsWith> <FieldRef Name='ContentTypeId' /> <Value Type='ContentTypeId'>YourContentTypeIdHere</Value> </BeginsWith>


Use <Today/> instead of the hardcoded value <Query> <Where> <And> <Geq> <FieldRef Name='EventDate' /> <Value IncludeTimeValue='TRUE' Type='DateTime'><Today /></Value> </Geq> <IsNotNull> <FieldRef Name='Title' /> </IsNotNull> ...


Create a calculated column that would calculate if your sort column is not NULL. The formula could look like this =IF(ISBLANK([ColumnName]),0,1) and the result can be 'Yes/No'. Now you can make sorting in your CAML by two columns (the new calculated and later your real column): <OrderBy> <FieldRef Name='MyIsBlankCalculatedColumn' Ascending='...


Unless you're sure that all the announcements you want has an Expire datetime then you're missing an "or+isnull" like this: <Query> <Where> <And> <IsNotNull> <FieldRef Name="Title" /> </IsNotNull> <Or> <IsNull> <FieldRef Name="Expires" /> </IsNull> <Geq> &...


If you add a column of type Person or Group, you get the option to add the column Name (with picture). If you check the fields feature in the 14 hive, there is a property on the Field definition called ShowField: <Field ID="{078B9DBA-EB8C-4ec5-BFDD-8D220A3FCC5D}" FieldRef="Editor" RowOrdinal="0" ReadOnly="TRUE" Type="...


Update your query to get the user field values like this: <FieldRef Name="User_x0020_Support_x0020_Delivery_x0020_Team" LookupId="TRUE" /> <Value Type="Integer"><UserID /></Value>


You can accomplish this by querying for all events greater than now() ordered by date, ascending. Then limit the query to 3 rows and you have all your data! Let me know if you need help creating the query itself, and please post what you have if you do.


The only thing you need to do to make that query valid, is ensure the Label1.Text uses the actual value, rather than the text 'Label1.Text' In C# it would be something like String camlQuery = "<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>" + Label1.Text + "</Value></Eq></Where>";


Partly answered: I just used the date and not the datetime. Since it was just announcements I didn't mind it being on the page for an extra day. The default expires field only holds the data value anyway. A simple <geq> on the Expires field with type="Date" did it for me.


As you can see from CAML Query schema, the IsNotNull element requires the FieldRef element, whose Name attribute is the internal name of the field. If you are building the CAML query in code, you can enumerate all the fields of the list and check if there is any that is of the type you are looking for; once found, you can get its internal name and use it ...

Only top voted, non community-wiki answers of a minimum length are eligible