Microsoft Graph Search API - $select fields of SharePoint Managed Property

Jonathan Aditya 1 Reputation point
2022-05-26T05:54:24.78+00:00

How am I able to select SharePoint Managed Property on the new Microsoft Search API?
Something as simple as:

{
    "requests": [
        {
            "entityTypes": [
                "driveItem"
            ],
            "query": {
                "queryString": "ContentTypeId:0x0120D520* AND *"
            },
            "from": 0,
            "size": 10,
            "fields": [
                "Title",
                "Path",
                "RefinableString01",
                "Description"
            ]
        }
    ]
}

Does not seem to be supported like in SharePoint Search API $select query.

Microsoft 365 and Office | SharePoint | Development
Microsoft Security | Microsoft Graph
{count} votes

3 answers

Sort by: Most helpful
  1. Zehui Yao_MSFT 5,881 Reputation points
    2022-05-26T10:12:35.557+00:00

    Hi @Jonathan Aditya , according to my understanding of your needs, you are using the Microsoft Search API to query Microsoft 365 data in your apps.

    Here is the docuemtation for your reference: https://learn.microsoft.com/en-us/graph/api/resources/search-api-overview?view=graph-rest-1.0

    205787-image.png

    In the case of getting selected properties, you can include in the fields property specific entity properties, including custom managed properties from SharePoint and OneDrive.
    And the query options are expressed in the POST body.
    205796-image.png

    Here is a sample of request body, hope it will help you.

    {  
      "requests": [  
        {  
          "entityTypes": [  
            "listItem"  
          ],  
          "query": {  
            "queryString": "contoso product"  
          },  
          "from": 0,  
          "size": 25,  
          "fields": [  
            "title",  
            "description"  
          ]  
        }  
      ]  
    }  
    

    205814-image.png


    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.


  2. Jonathan Aditya 1 Reputation point
    2022-05-30T13:23:07.29+00:00

    @Zehui Yao_MSFT Now I get that I need to use
    listItem
    instead of
    driveItem
    .

    I am now curious on why the search results within fields are lowercased by default and does not follow the correct managed property naming convention..
    206735-image.png


  3. Preeti Teotia 106 Reputation points Microsoft Employee
    2022-11-10T16:28:07.297+00:00

    @Tong Zhang_MSFT
    @Zehui Yao_MSFT

    In fields we provide the column names which we want to receive in response.

    But how can we get all columns in response? "*" is not working

    {  
        "requests": [  
            {  
                "entityTypes": [  
                    "listItem"  
                ],  
                "query": {  
                    "queryString": "issue"  
                },  
                "fields": [  
                    "*"  
                ]  
            }  
        ]  
    }  
    
    0 comments No comments

Your answer

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