tags:

views:

1241

answers:

1

I have this CAML (lol thanks to Alex)

query.Query = @"<Where><Eq><FieldRef Name='MessageID' /><Value Type='Text'></Value></Eq></Where>";

This checks if the value of MessageID = string.empty()

What I would like to check for is null.... not empty string...

Is this possible with CAML?

+5  A: 

CAML has the IsNull operator,so the query would be:

query.Query = @"<Where><IsNull><FieldRef Name='MessageID' /></IsNull></Where>"
Colin
How on earth do you know this type of thing? :) but thanks!
JL
Lol - only problem is it doesn't work :)
JL
How does it not 'work' You could try using an Or statement, check for empty AND Null values?
Colin
P.S. what type is the field of anyway, it says MessageID. Is that an integer?
Colin
Its a string... but when I step through in code... and check the value... its null....
JL
Did you add this field to the list later on? Because SharePoint doesn't update Existing items when the field is added, I guess you could describe it as "the field exists but no value has been assigned, not even Null"
Colin
Don't be mad, this time it was my bad, it works :)
JL
Cool! P.S. how I know these things? Mainly through many frustrated hours :-D
Colin