0

In a CAML query, can you filter items which has values in the column (Not Null), based on the FieldType of the column. regardless of the Column name ?

2 Answers 2

1

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 dynamically populate the FieldRef Name attribute.

An example using the JSOM (in C# it would be similar) to retrieve all fields and their types can be found here on SharePoint.SE

1
  • 1
    Nice workaround. I am using the Server Object model, but the example gave an idea. Used the field type to get hold of the column name through C# and used that for the CAML query. Thanks !
    – Shaamil
    Feb 10, 2014 at 12:30
0

Both Field Internal name and Value type (Field type) are required while making CAML queries. In REST you can query using field names only. However, I don't remember/know of any way where you can only specify field type only.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.