Creating field with validation using CAML XML

January 15, 2012

Hi guys,   Here's a quick tip for creating a field with validation using Caml xml.   Suppose you want to validate a DateTime field that shows the current date + 2 years.   <FieldID="{Guid}"Name="ExpiredDate"DisplayName="Expired Date"Type="DateTime"Format="DateOnly"Required="TRUE">   <ValidationMessage="You can not pick a date two years later then the current date">   =ExpierdDate&lt;=DATE(YEAR(TODAY())+2,MONTH(TODAY()),DAY(TODAY())) </Validation> </Field>   That all folks :) Special thanks to Shiri O'Connell with this example.  
one comment