web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Update a lookup column...
Power Automate
Unanswered

Update a lookup column through REST API

(0) ShareShare
ReportReport
Posted on by

Hi,

 

I'm struggling to get the correct syntax to update the value of a lookup column of a file in a document library. I've looked at this post (and the article that it points to):

https://powerusers.microsoft.com/t5/Building-Flows/Need-correct-syntax-to-update-lookup-column-property-using-HTTP/m-p/529092#M68119

 

However, there's still quite a difference between the syntax needed here and that for the 'Send an HTTP request to SharePoint' action in Power Automate. I've tried a syntax which just adds the string 'Id' to the end of the lookup column name and sets it through POST request:

mjensen98_1-1613541960339.png

 

However, it throws this error:

mjensen98_0-1613541945234.png

 

Would someone please be able to help me out with this?

Thanks

 

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @mjensen98,

     

    Is it a single lookup or do you allow multiple lookup values?

     

    If it is a single lookup you could use this approach:

     

    URI

    _api/web/lists/getbytitle('@{variables('ListName')}')/Items(1)

     

    Headers

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

     

    Body

    {
     "__metadata": {
     "type": "@{outputs('Send_an_HTTP_request_to_SharePoint')?['body/ListItemEntityTypeFullName']}"
     },
     "Doc_ContentId": 1 
     }

    singlelookupvalue.png

  • SvampK Profile Picture
    16 on at

    Hi !@Expiscornovus 
    Facing some similar problem, although is a multiple value lookup column,

    have been googled around but couldn't really find the answer. I wonder if you can answer me?

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @SvampK,

     

    Try this for the body of a multi-lookup field. Keep in mind that the name of the column in this example is Doc_Content and the Id part is added to the end of it.

     

    {
     "__metadata": {
     "type": "@{outputs('Send_an_HTTP_request_to_SharePoint')?['body/ListItemEntityTypeFullName']}"
     },
     "Doc_ContentId": {"results": [1,2] } 
     }

     

  • SvampK Profile Picture
    16 on at

    Thank you so much @Expiscornovus  you are a superhero 🙂

  • raflderaf Profile Picture
    on at

    And what do I have to replace this with if I want to apply this to my (Multi) lookup Column "DocsToProduct" in my List "Products" which looks up Multiple items in the List "Docs" (Docs-Item IDs: [71,68]) :

    @{outputs('Send_an_HTTP_request_to_SharePoint')?['body/ListItemEntityTypeFullName']}

     I dont really see it from this...

  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @raflderaf,

     

    Normally the value of the type field is something like SP.Data.<NameOfListEncoded>ListItem. In your case it is probably SP.Data.DocsListItem

     

    In my example I dynamically retrieved the type value from another Send an HTTP request to SharePoint action. In that case I used the below.

     

    listitementitytypefullname.png

     

    Read more about that approach in one of my blogs: https://www.expiscornovus.com/2021/07/10/listitementitytypefullname-within-power-automate/

     

  • DevanKSmith Profile Picture
    6 on at

    You are awesome, was having the same issue and was trying for a day to figure it out. This comment got it working first try!!

  • raflderaf Profile Picture
    on at

    I have actually also found another solution to my specific problem (I just now realised that this post is about editing a multiple-lookup-column in a document library. I was looking for a solution for a sharepoint list): it doesnt need a syntax as complicated as this. Here is the link: How to update multiple lookup SharePoint column with Power Automate (tomriha.com)

    raflderaf_0-1720706608123.pngraflderaf_1-1720706630667.png

    These are screenshot from that website, which held the answer.

  • DevanKSmith Profile Picture
    6 on at

    Yeah I actually stumbled upon that blog post as well when looking for a solution. I just ran into the problem that I was getting the Id's dynamically based on other inputs from the beginning of the flow, so it was hard to switch from array to string and add the ;# to the end of each Id except the last one. 

    {
     "__metadata": {
     "type": "@{outputs('Send_an_HTTP_request_to_SharePoint')?['body/ListItemEntityTypeFullName']}"
     },
     "Doc_ContentId": {"results": [1,2] } 
     }

    This solution worked perfect for me and after results: I put the array of id's.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard