Question

I am creating a feature that declares a custom list template and a list instance from this template. Also, ListInstance contains several rows with default data and in my content type there's a DateTime field with DateTimeFormat set to DateTime.

The part with DateTime field in ListInstance looks like follows:

<Row>
  <Field Name="MyOtherField"></Field>
  <Field Name="MyDateTimeField">2011-12-30T21:00:00.0000000Z</Field>
  <Field Name="MyIntField">0</Field>
</Row>

When I am trying to activate a feature, if shows me the following error: The element 'MyListInstance' of type 'ListInstance' for feature 'MyFeature' (id: GUID) threw an exception during activation: String was not recognized as a valid DateTime.

Was trying to use local datetime format (en-US) or ISO 8601 format - no luck so far.

So the question is - what datetime format to use when I need to define DateTime field value in ListInstance?

Was it helpful?

Solution

Try:

<Row>
  <Field Name="MyOtherField"></Field>
  <Field Name="MyDateTimeField">2011-12-30T21:00:00Z</Field>
  <Field Name="MyIntField">0</Field>
</Row>

I have a Feature that has loaded a Date field using that format.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top