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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

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 Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Top Kudoed Authors
Users online (4,005)