0

I am working on an online SharePoint site collection, where I have a calculated column named "ExpiryDate" of type Datetime, and I want to get all the pages which have their expiry date equal today, i tried the following CAML query , but it did not return any pages:

CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<View><Query><Where><Eq><FieldRef Name ='ExpiryDate'/><Value Type='DateTime'>Today/></Value></Eq></Where></Query><RowLimit>3000</RowLimit></View>";

Any idea why my query is not working?

1 Answer 1

1

I can see there is a syntax error in your code near <Today/>. Use it like below:

CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<View><Query><Where><Eq><FieldRef Name ='ExpiryDate'/><Value Type='DateTime'><Today/></Value></Eq></Where></Query><RowLimit>3000</RowLimit></View>";

If that does not work then try using:

<Query><Where><Eq><FieldRef Name="ExpiryDate" /><Value Type="Calculated"><Today/></Value></Eq></Where></Query>

Your Answer

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

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