I'm using the SharePoint 2013 REST API (my last choice, technological constraints require using it vs CSOM) and am encountering an issue when trying to clear any non-string (date, number, etc) field value.

Assume my list item has three columns, named CustomColumn1, CustomColumn2, and CustomColumn3. CustomColumn1 is a single-line string column, CustomColumn2 is a datetime column, and CustomColumn3 is a number column.

If I make a POST with the X-HTTP-METHOD set to "MERGE," meaning I want to update an existing list item, the following results occur:

Scenario 1 Postdata

{'__metadata': { 'type' : 'SP.Data.MYITEMTYPE' }, 'CustomColumn1' : 'string value', 'CustomColumn2' : '12/20/2013', 'CustomColumn3' : '123.45'}

Scenario 1 Result

Each field is updated properly.

Scenario 2 Postdata

"{'__metadata': { 'type' : 'SP.Data.MYITEMTYPE' }, 'CustomColumn1' : '', 'CustomColumn2' : '12/21/2013', 'CustomColumn3' : '123.456'}"

Scenario 2 Result

CustomColumn1 is cleared, CustomColumn2 and CustomColumn3 are updated.

Scenario 3 Postdata

"{'__metadata': { 'type' : 'SP.Data.MYITEMTYPE' }, 'CustomColumn1' : '', 'CustomColumn2' : '', 'CustomColumn3' : ''}"

Scenario 3 Result

SharePoint returns a 400 error, bad request.

Scenario 4 Postdata

"{'__metadata': { 'type' : 'SP.Data.MYITEMTYPE' }, 'CustomColumn1' : '', 'CustomColumn2' : NULL, 'CustomColumn3' : NULL}"

Scenario 4 Result

SharePoint returns a 400 error, bad request.

Scenario 5 Postdata

"{'__metadata': { 'type' : 'SP.Data.MYITEMTYPE' }, 'CustomColumn1' : '', 'CustomColumn2' : 'NULL', 'CustomColumn3' : 'NULL'}"

Scenario 5 Result

SharePoint returns a 400 error, bad request.

After spending a while researching, I did not find any kind of solution to this. I found a Microsoft document of "SharePoint 2013 known issues" that seems to outline this as a known issue, but the solution doesn't really line up with the problem.

Exact quote:

Updating a list item doesn’t work when updating an item field with empty value

When you try to update list item field that is non-string types, such as Date/Time, Boolean, Number, or Person, with empty value using Update List Item action, it doesn’t work. Updating string type field with empty string or updating single user type field with empty value works well.

Workaround Try to call the SharePoint 2010 workflow using the Start a list/site workflow action.

Any thoughts?


Change NULL to null. I tried the following - first test resulted in a 400 Bad Request error, the second one worked fine.

{'__metadata': { 'type': 'SP.Data.TasksListItem' },'StartDate': NULL}

{'__metadata': { 'type': 'SP.Data.TasksListItem' },'StartDate': null}

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.