Forum Discussion

Etienne Fortin's avatar
Etienne Fortin
Copper Contributor
May 15, 2017

Adding Sharepoint Lookup Item With Graph

I'm experimenting with Graph (Beta) with Sharepoint. I can create items and update their fields. It works for simple  fields like text andnumbers. Howerver, I can't figure out how to update fields like lookup and the one with multiple values.

 

If I read an item and look at a lookup field, it looks like this:

 

  "Predecessors": [
{
"LookupId": 80,
"LookupValue": "Create general slides masters"
}
]

 

If I do the same format (but only the LookupId portion) with a PATCH request and the right url, it gives e malformed request. 

 

Anyone knows how to form the request for these more complex types?

 

Etienne Fortin 

14 Replies

  • Sten_Vervoort's avatar
    Sten_Vervoort
    Copper Contributor

    Etienne Fortin The key is to append "LookupId" to the column name. So if the lookup column name is "Predecessors", then insert the following JSON:

     

     "PredecessorsLookupId": 80,

     

    See https://sharepoint.stackexchange.com/questions/238346/how-to-do-microsoft-graph-api-filter-on-lookup-column-in-sharepoint-list-items

  • Anders Looft's avatar
    Anders Looft
    Copper Contributor

    Did you find an answer yet? Having the same issue, only when creating an item instead of updating

    • Etienne Fortin's avatar
      Etienne Fortin
      Copper Contributor

      No I didn't.

       

      But you mention being able to update a lookup item? How do you proceed? How did you make it work. I can't update either.

      • Anders Looft's avatar
        Anders Looft
        Copper Contributor
        I'm sorry if I was unclear, but no, I have not gotten update to work (nor tried to) either. I just get the same errors as you.
    • Etienne Fortin's avatar
      Etienne Fortin
      Copper Contributor

      Unfortunetely not. Can't figure out how to do it.

      • Ketill Antoníus Ágústsson's avatar
        Ketill Antoníus Ágústsson
        Copper Contributor

        Too bad :( 

         

        But are you successfully calling the view-items endpoint: 

        /beta/sites/{site-id}/lists/{list-id}/items

         and getting a non-null response? 

         

        Because all I get as a response is:

        {
            "@odata.context": "https://graph.microsoft.com/beta/...",
            "value": []
        }

         

Resources