How to fetch "@microsoft.graph.downloadUrl" from Microsoft Search API?

Viewed 674

I am using Microsoft Search API to search for files in SharePoint, objective is to fetch temporary url ("@microsoft.graph.downloadUrl") amoung other fields. I have used below search request,

Url - POST request: https://graph.microsoft.com/v1.0/search/query
Body:
{
    "requests": [
        {
            "entityTypes": [
                "driveItem"
            ],
            "query": {
                "queryString": "search-value",
                "query": "path:\"https://{company}.sharepoint.com/sites/{site}/shared\""
            },          
            "fields": [
                "name",
                "webUrl",
                "@microsoft.graph.downloadUrl"
            ]
        }
    ]
}

The result returned is below, and it is missing "@microsoft.graph.downloadUrl" field.

 "moreResultsAvailable": false,
    "hits": [
        {
            "hitId": "01CDLPULQVGFRNVHYTJVFL3NPPXIGOUDUS",
            "rank": 1,
            "summary": "string;#<c0>search-value</c0> <c0>search-value</c0> Internal 1 0 search-value Graph explorer {DA623115<ddd/>",
            "resource": {
                "@odata.type": "#microsoft.graph.driveItem",
                "name": "word.docx",
                "webUrl": "https://company.sharepoint.com/sites/{site}/Cases/search-value/word.docx"
            }
        },
1 Answers
Related