cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
eliotcole
Power Participant
Power Participant

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
Power Participant
Power Participant

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
Power Participant
Power Participant

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

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,076)