Click here to Skip to main content
15,909,193 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

How can I filter all columns that are empty in caml query? here's my code;


XML
spSiteDataQuery = new SPSiteDataQuery();
                   spSiteDataQuery.Query = "<Where><Neq><FieldRef Name=\"ContentType\" /><Value Type=\"Text\">" + "</Value></Neq></Where>";
                   spSiteDataQuery.ViewFields = "<FieldRef Name=\"Title\"/>" + "<FieldRef Name=\"FileRef\" />" + "<FieldRef Name=\"Modified\"/>" + "<FieldRef Name=\"Created\"/>";
                   spSiteDataQuery.Lists = "<Lists ServerTemplate=\"850\"/>";
                   spSiteDataQuery.Webs = "<Webs Scope=\"Recursive\" />";

                   dtPages = spWeb.GetSiteData(spSiteDataQuery);


it throws exception in

XML
<value type ...></value>;


is
XML
<IsNull></IsNull>;
returns the same?
Posted
Comments
Sayan Bera 12-May-14 5:47am    
What is the value you are entering to check?
<value type="\"Text\">" + "</value>"
What is "+"?
macmacmacmac 12-May-14 6:17am    
actually, I thought leaving no value in this parameters mean empty string. I just divided the string by using + sign
Sayan Bera 12-May-14 6:36am    
"<Where><Eq>",
"<FieldRef Name='Time_x0020_of_x0020_Selection'/>",
"<Value Type='DateTime'><Today OffsetDays=’-0′></Value>",
"</Eq></Where>");

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900