I'm trying to write an InfoPath form from code.

I'm working with the xml of a form, and when I write a date it gives me no error but when I open the form in SharePoint and click on Save, it says that the dates are not correct, exactly it says:

Date Field "Only date allowed"

Note: I have tried with different formats and even that the format is the same that is showed if you choose a correct date.

Note: I use to write the xml element the next code:

writer.WriteElementString("my", "EntryDate",null, "");

1 Answer 1


Check the properties of the date control. Set data type to Text (String) and change format to XML (Click format button and select "None" option.


  • thanks Ali, but I prefer if possible not to change the data type, is ok being date. Aug 8, 2014 at 10:05

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.