SharePoint Search REST API Not Returning Lookup Column Values in Single Library Search

Rishikesh Rai 55 Reputation points
2023-09-28T16:53:15.13+00:00

Dear Community,

I'm working with SharePoint Search REST API, and I'm encountering an issue where the API is not returning the values of lookup column in the search results when performing a search within a single library. I have configured my query to include the lookup column using the 'selectproperties' parameter, but I'm only getting empty or null values for the lookup column.

Here's an example of the query string:

const searchQuery: string = `?querytext='${encodeURIComponent(query)}'&path='${props.spData.context.pageContext.web.absoluteUrl}/Lists/<listName>'&selectproperties='Title,MainHeader,Author'&RowLimit=100&clienttype='Custom'`;

I expected to see the actual value of the lookup column in the search results.

**MainHeader is the lookup column.User's image

Is there a specific configuration or parameter I need to set to ensure that the Search API return the lookup values? Please help me with the configuration to resolve this issue.

Thanks,

Microsoft 365 and Office | Install, redeem, activate | For business | Windows
Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

Accepted answer
  1. RaytheonXie_MSFT 40,486 Reputation points Microsoft External Staff
    2023-09-29T06:35:27.8133333+00:00

    Hi @Rishikesh Rai,

    You will need to manually create the managed property for Lookup column as it is not created automatically. You can follow the steps in the nice article

    https://sharepointmaven.com/how-to-create-a-managed-property-in-sharepoint-online/

    Here is the document for reference

    https://learn.microsoft.com/en-us/microsoft-365/community/how-do-site-columns-become-managed-properties-thus-available-for-search


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    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.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.