3

I have tried setting my date field to an empty string ("") and setting it to "01/01/0001". Both returned the error "String is not formatted as date time". I have several thousand items across a few subsites which mistakenly received some December date, and I'd like those to be set to empty.

Workflows have proven to take too long for this process, and I already have a C# utility written to update all fields that I specify (e.g., "set "Modified By" on all items with ID > 500 to [My Name]"), but I cannot seem to find a way set a date field back to empty.

  • Can you share your code? Try setting the date to null instead of an empty string. – Mike Jul 21 '14 at 18:52
  • It's a part of a longer utility. I set date fields in the following format: ` item["Modified"] = Convert.ToDateTime("01/01/0001"); – Dinerdo Jul 21 '14 at 18:54
  • 1
    Try item["Modified"] = null; – Mike Jul 21 '14 at 18:55
6

Try item["Modified"] = null;

That should make the Date/Time field empty.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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