cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
eliotcole
Super User
Super User

SharePoint How To Set Integer, Number, Date, etc List Item Columns To Null

I'm just posting this here as I don't like to upload the data to the solutions part of things

 

This should work if you're having trouble creating or updating a SharePoint list item column item to a null value.

 

This has been seen over a variety of column types.

 

Answer follows in a second.

 

Please go and vote up the feature update that's been 'PLANNED' for nearly 5 years:

Allow us to update a numeric field to null/blank value

 

1 ACCEPTED SOLUTION

Accepted Solutions
eliotcole
Super User
Super User

This should get what you need, feel free to replace GetById with GetByName and use the list name (I just know that I change mine a lot ).

 

Send an HTTP request to SharePointSend an HTTP request to SharePoint

 

Create a Send an HTTP request to SharePoint action as a POST in your flow:

  • URI_api/web/lists/GetById('YOUR_LIST_ID')/items(ITEM_ID)
  • Headers - code follows list - You need Content-Type, Accept, IF-MATCH, and X-HTTP-Method, headers.
  • Body - code follows list - Clarify the '__metadata' 'type' to "SP.Data.LIST_NAMEListItem" (where LIST_NAME is case sensitive, with a capitalised first letter), then list any fields (case sensitive) that you'd like to make null, and set the value to null.

The only caveat is that you may need to ensure that you have the right type if you're doing cleverer things with your SharePoint list.

 

URI

 

 

_api/web/lists/GetById('YOUR_LIST_ID')/items(ITEM_ID)

 

 

 

Header JSON

 

 

{
  "Content-Type": "application/json;odata=verbose",
  "Accept": "application/json;odata=verbose",
  "IF-MATCH": "*",
  "X-HTTP-Method": "MERGE"
}

 

 

 

Body JSON

 

 

{
	"__metadata": {
		"type": "SP.Data.LIST_NAMEListItem"
	},
	"YOUR_LIST_COLUMN_NAME": null
}

 

 

  • LIST_NAME is the exact name of the list, case sensitive, but *always* capitalise the first letter.
  • YOUR_LIST_COLUMN_NAME is exactly the case sensitive to the list column.

 

View solution in original post

1 REPLY 1
eliotcole
Super User
Super User

This should get what you need, feel free to replace GetById with GetByName and use the list name (I just know that I change mine a lot ).

 

Send an HTTP request to SharePointSend an HTTP request to SharePoint

 

Create a Send an HTTP request to SharePoint action as a POST in your flow:

  • URI_api/web/lists/GetById('YOUR_LIST_ID')/items(ITEM_ID)
  • Headers - code follows list - You need Content-Type, Accept, IF-MATCH, and X-HTTP-Method, headers.
  • Body - code follows list - Clarify the '__metadata' 'type' to "SP.Data.LIST_NAMEListItem" (where LIST_NAME is case sensitive, with a capitalised first letter), then list any fields (case sensitive) that you'd like to make null, and set the value to null.

The only caveat is that you may need to ensure that you have the right type if you're doing cleverer things with your SharePoint list.

 

URI

 

 

_api/web/lists/GetById('YOUR_LIST_ID')/items(ITEM_ID)

 

 

 

Header JSON

 

 

{
  "Content-Type": "application/json;odata=verbose",
  "Accept": "application/json;odata=verbose",
  "IF-MATCH": "*",
  "X-HTTP-Method": "MERGE"
}

 

 

 

Body JSON

 

 

{
	"__metadata": {
		"type": "SP.Data.LIST_NAMEListItem"
	},
	"YOUR_LIST_COLUMN_NAME": null
}

 

 

  • LIST_NAME is the exact name of the list, case sensitive, but *always* capitalise the first letter.
  • YOUR_LIST_COLUMN_NAME is exactly the case sensitive to the list column.

 

Helpful resources

Announcements
MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power automate tips 768x460 v2.png

Restore a Deleted Flow

Did you know that you could restore a deleted flow? Check out this helpful article.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Users online (2,245)