Graph search in SPO page query result truncated

Samuel Lévesque 26 Reputation points
2021-08-19T19:24:50.703+00:00

Hi,

I'm doing the following query on a SharePoint site to retrieve latest news :

POST v1.0 https://graph.microsoft.com/v1.0/search/query

Body
{
"requests": [
{
"entityTypes": [
"listItem"
],
"query": {
"queryString": "PromotedState=2 AND path:\"https://tenant.sharepoint.com/SitePages*\""
},
"from": 0,
"size": 5,
"sortProperties": [
{
"name": "FirstPublishedDate",
"isDescending": true
}
]
}
]
}

The value I want to retrieve is the auto generated content in the field "summary" 124757-summary.png

Results :

{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.searchResponse)",
"value": [
{
"searchTerms": [],
"hitsContainers": [
{
"total": 4,
"moreResultsAvailable": false,
"hits": [
{
"hitId": "DA08628F-692D-4B2C-B4A3-3C2219EC4BCC",
"rank": 1,
"summary": "Comment effectuer la prise en main ? Sélectionnez « Modifier » pour commencer à utiliser ce modèle de base de deux colonnes et mettre l'accent sur le texte et les exemples de la<ddd/>",
"resource": {
"@odata.type": "#microsoft.graph.listItem",
"fields": {
"title": "TEST1234",
"firstPublishedDate": "2021-04-22T17:43:09Z"
}

As you can see the Summary field appears to be truncated after 170 characters instead of the 255 characters available :

Result from the query :
Comment effectuer la prise en main ? Sélectionnez « Modifier » pour commencer à utiliser ce modèle de base de deux colonnes et mettre l'accent sur le texte et les exemples de la<ddd/>

Value stored in the field from SPO:
Comment effectuer la prise en main ? Sélectionnez « Modifier » pour commencer à utiliser ce modèle de base de deux colonnes et mettre l'accent sur le texte et les exemples de la mise en forme du texte. Avec votre page en mode d’édition, sélectionnez…

Any idea how to return the full string ?

Regards

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,831 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sébastien Levert 76 Reputation points Microsoft Employee
    2021-08-20T19:37:42.5+00:00

    Hey @Samuel Lévesque !

    You should select the fields you need. In this case, the summary field is truncated by default and only focuses on the main part of the description. This could also be from the content of the page in some scenarios. To ensure you are getting back the Description field from search, please include the "description" field in the retrieved fields, like this :

    {  
        "requests": [  
            {  
                "entityTypes": [  
                    "listItem"  
                ],  
                "query": {  
                    "queryString": "PromotedState=2 AND path:\"https://tenant.sharepoint.com/SitePages*\""  
                },  
                "fields": [  
                    "id",  
                    "name",  
                    "contentclass",  
                    "title",  
                    "description"  
                ]  
            }  
        ]  
    }  
    

    Hope this works for you!


0 additional answers

Sort by: Most helpful