Skip to main content
  1. Posts/

Update Columns in SharePoint using REST API

4 mins· loading · loading ·
Will Wright
Power Automate SharePoint Flow
Will Wright
Author
Will Wright
A powerful, lightweight theme for Hugo built with Tailwind CSS.
Table of Contents
SharePoint REST API - This article is part of a series.

To update a columns within a SharePoint list using the SharePoint REST API action in Flow. Add the following code to the Body of the action.

In any of the examples below anything in between <> will need to be updated with actual values

To get the value for the __metadata type use the following url _api/web/lists/GetByTitle('<list>')

Updating a Choice column
#

{
'__metadata': {
'type': 'SP.Data.<ListName>ListItem'
},
'Choice': 'Choice #1'
}

Updating a Multi-Choice column
#

{
'__metadata': {
'type': 'SP.Data.<ListName>ListItem'
},
'multiChoice': { 'results': ['Choice #1', 'Choice #2']},
}

The format for multiple entries must be ['Choice #1', 'Choice #2']. If you need to blank or leave empty use '' in place of the choice.

Updating a Date column
#

{
'__metadata': {
'type': 'SP.Data.<ListName>ListItem'
},
'Date': `utcNow()`
}

The date must be in a valid format to be accepted by SharePoint

Updating a Lookup column
#

{
'__metadata': {
'type': 'SP.Data.<ListName>ListItem'
},
'Title': 'text'
}

Updating a Multi-Lookup column
#

{
'__metadata': {
'type': 'SP.Data.<ListName>ListItem'
},
'Title': 'single line of text'
}

Updating a URL column
#

{
'__metadata': {
'type': 'SP.Data.PILDatabaseListItem'
},
'Url': {
'__metadata': { 'type': 'SP.FieldUrlValue' },
'Description': 'What you want the link to say',
'Url': 'Link to the item/site'}
}

Updating a Single Line of Text column
#

{
'__metadata': {
'type': 'SP.Data.<ListName>ListItem'
},
'Title': 'single line of text'
}

Updating a Person column
#

{
'__metadata': {
'type': 'SP.Data.<ListName>ListItem'
},
'PersonId': '-1'
}

Note ‘Id’ is added to the internal name of the SharePoint column.

The number required is the SharePoint Id of the person or group. To get this Id you can use the action Get items and use the hidden SharePoint list User Information List. Use the oData filter and filter on Email using the persons email address. To avoid an Apply to each action use the formula first(body('Get_author_information')?['value'])?['Id']. If you need to blank or leave empty use -1 in place of the Id.

Updating a Multi-Person column
#

{
'__metadata': {
'type': 'SP.Data.<ListName>ListItem'
},
'PersonsId': { 'results': [0]}
}

Note ‘Id’ is added to the internal name of the SharePoint column.

The number required is the SharePoint Id of the person or group. To get this Id you can use the action Get items and use the hidden SharePoint list User Information List. Use the oData filter and filter on Email using the person email address. The format for multiple entries must be [1,2,3,4]. If you need to blank or leave empty use 0 in place of the Id.

Updating a Managed Metadata column
#

To update a managed metatdata column within a SharePoint list using the SharePoint REST API action in Flow. Add the following to the sections Method, Uri, Header and Body of the action.

In any of the examples below anything in between <> will need to be updated with actual values

Method Post

Uri _api/web/lists/getbytitle('<listName>')/items(<itemId>)/ValidateUpdateListItem()

Headers

content-type: application/json;odata=verbose
accept: application/json;odata=verbose

To get the value for the __metadata type use the following url _api/web/lists/GetByTitle('<list>')

{
'formValues': [
{'FieldName':'MultiManagedMetadata',
'FieldValue':'Term 1|00000000-0000-0000-0000-000000000001}]
}

Term 1 is name of the term which the GUID is the Id of the term

To get the GUID for the term you can use another HTTP request action using Post and the Uri of _vti_bin/TaxonomyInternalService.json/GetSuggestions and the Body

{'start':'Term 1', 
'lcid':1033,  
'sspList':'<sspList>',  
'termSetList':'<termSetList>',  
'anchorId':'00000000-0000-0000-0000-000000000000',  
'isSpanTermStores':false,  
'isSpanTermSets':false,  
'isIncludeUnavailable':false,  
'isIncludeDeprecated':false,  
'isAddTerms':false,  
'isIncludePathData':false,  
'excludeKeyword':false,  
'excludedTermset':'00000000-0000-0000-0000-000000000000'}

To get the sspListId the following url will display it https://<tenant>.sharepoint.com/sites/<site>/_api/web/lists/getbytitle('<list>')/fields?$filter=InternalName eq '<internalMetadataColumnName>'

To get the termSetList Id go to the TermStore Admin Centre https://<tenant>.sharepoint.com/sites/<site>/_layouts/15/SiteAdmin.aspx#/termStoreAdminCenter

Image of termSetList

Updating a Multi-Managed Metadata column
#

To update a multi managed metatdata column within a SharePoint list using the SharePoint REST API action in Flow. Add the following to the sections Method, Uri, Header and Body of the action.

In any of the examples below anything in between <> will need to be updated with actual values

Method Post

Uri _api/web/lists/getbytitle('<listName>')/items(<itemId>)/ValidateUpdateListItem()

Headers

content-type: application/json;odata=verbose
accept: application/json;odata=verbose

To get the value for the __metadata type use the following url _api/web/lists/GetByTitle('<list>')

{
'formValues': [
{'FieldName':'MultiManagedMetadata',
'FieldValue':'Term 1|00000000-0000-0000-0000-000000000001;Term 2|00000000-0000-0000-0000-000000000002'}]
}
  • FieldName is the internal name of the columns
  • FieldValue is the format the contents of the field it needs to be in the format Term|GUID;Term|GUID

Term 1 is name of the term whilst the GUID is the Id of the term

To get the GUID for the term you can use another HTTP request action using Post and the Uri of _vti_bin/TaxonomyInternalService.json/GetSuggestions and the Body

{'start':'Term 1', 
'lcid':1033,  
'sspList':'<sspList>',  
'termSetList':'<termSetList>',  
'anchorId':'00000000-0000-0000-0000-000000000000',  
'isSpanTermStores':false,  
'isSpanTermSets':false,  
'isIncludeUnavailable':false,  
'isIncludeDeprecated':false,  
'isAddTerms':false,  
'isIncludePathData':false,  
'excludeKeyword':false,  
'excludedTermset':'00000000-0000-0000-0000-000000000000'}

To get the sspListId the following url will display it https://<tenant>.sharepoint.com/sites/<site>/_api/web/lists/getbytitle('<list>')/fields?$filter=InternalName eq '<internalMetadataColumnName>'

To get the termSetList Id go to the TermStore Admin Centre https://<tenant>.sharepoint.com/sites/<site>/_layouts/15/SiteAdmin.aspx#/termStoreAdminCenter

Image of termSetList
SharePoint REST API - This article is part of a series.

Related

Sending an HTTP request to SharePoint
1 min· loading · loading
Will Wright
Power Automate SharePoint Flow
Update Environment Variables
3 mins· loading · loading
Will Wright
Power Automate Dataverse Canvas Apps Environment Variables Flow