3

I want to initialize a list in a SharePoint Online Add-in with the following XML:

<?xml version="1.0" encoding="utf-8"?>
  <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <ListInstance Title="Punchlist Items" OnQuickLaunch="FALSE" TemplateType="100" Url="Lists/Punchlist Items" Description="">
      <Data>
        <Rows>
          <Row>
            <Field Name="Title">This is an open punchlist item</Field>
            <Field Name="PunchlistNumber">AHU0101-PL-0001</Field>
            <Field Name="Open">2015-01-02T00:00:00Z</Field>
            <Field Name="TypeId">1</Field>
            <Field Name="GMP">true</Field>
            <Field Name="ResponsibleId">1</Field>
            <Field Name="Closed"></Field>
          </Row>
        </Rows>
      </Data>
    </ListInstance>
  </Elements>

But I'm receiving an error:

String was not recognized as a valid DateTime

When the Closed field is empty (it works fine if I give Closed a value like 2015-01-02T00:00:00Z). Is there a way to create the row with an empty DateTime field? I don't want a value in the Closed field and it is not a required field.

2
  • 1
    Check by removing Closed field entry from your XML and see if it works.
    – Pradip R.
    Jan 11, 2018 at 13:21
  • 1
    That's it - thank you. If you post it as as an answer I'll accept
    – dikuw
    Jan 11, 2018 at 13:27

1 Answer 1

2

Remove the Closed field from that XML Row and you will no longer get the error mentioned and it will be stored as an empty.

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.