Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
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

 

  • DevanKSmith Profile Picture
    6 on at
    Re: Update a lookup column through REST API

    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.

  • raflderaf Profile Picture
    4 on at
    Re: Update a lookup column through REST API

    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
    Re: Update a lookup column through REST API

    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!!

  • Expiscornovus Profile Picture
    31,844 Most Valuable Professional on at
    Re: Update a lookup column through REST API

    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/

     

  • raflderaf Profile Picture
    4 on at
    Re: Update a lookup column through REST API

    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...

  • SvampK Profile Picture
    16 on at
    Re: Update a lookup column through REST API

    Thank you so much @Expiscornovus  you are a superhero 🙂

  • Expiscornovus Profile Picture
    31,844 Most Valuable Professional on at
    Re: Update a lookup column through REST API

    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
    Re: Update a lookup column through REST API

    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
    31,844 Most Valuable Professional on at
    Re: Update a lookup column through REST API

    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

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492