get ListItem returns lookupID instead of lookupValue for lookupCollums

Oliver Funk 21 Reputation points
2021-09-05T11:52:48.31+00:00

a SPO list which contains lookup fields does not return the shown values in SPO list view but the lookupID instead.

using getListItem as well as getListItemID both return not the shown values in SPO list view but the lookupID values - which makes it hard to do any kind of Join visible with one request.
Is that build by design or a bug.

see below a sample
https://graph.microsoft.com/v1.0/sites/xyz.sharepoint.com,xxxxxxx/lists/yyyyyyyyyy/items?$expand=fields
returns
"fields": {
"@odata.etag": "\"e6b81beb-9cf1-4c8b-b5dc-2f298bfdefeb,3\"",
"Title": "001-200",
"JahrLookupId": "3",
"ReferatLookupId": "1",

Microsoft Graph Site Lists API
Microsoft Graph Site Lists API
A Microsoft API that "supports access to SharePoint sites, lists, and drives; read-only support for site resources; read-write support for lists, listItems, and driveItems; and address resources by SharePoint ID, URL, or relative path.
329 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
1,981 questions
0 comments No comments
{count} votes

Accepted answer
  1. Michael 17,921 Reputation points
    2021-09-06T02:10:05.773+00:00

    Hi @Oliver Funk ,

    Per my test, I could get the same result as yours on my end. Seems like it's by design that it would return the lookupId for lookupColumns in the response.

    As a workaround, you could specify the return fields in the request like this: ?$expand=fields($select=lookupcolumn1,lookupcolumn2)

    https://graph.microsoft.com/v1.0/sites/xyz.sharepoint.com,xxxxxxx/lists/yyyyyyyyyy/items?$expand=fields($select=id,Title,Jahr,Referat)  
    

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Red217 1 Reputation point
    2022-08-07T16:14:54.94+00:00

    Hi,
    i dont really understand the workaround , how can i get "the content" if it isnt there ?
    all i am getting is the LookupID :-(

    0 comments No comments