Searching for SharePoint Documents by Custom Column Value using Microsoft Graph API from Postman

618 Views Asked by At

How can I use the Microsoft Graph API from Postman to search for documents within all SharePoint sites in an organization based on a specific value in a custom column? I am currently not getting the expected results when making the request:

GET https://graph.microsoft.com/v1.0/search?$filter=listItem/all(d:d/fields/UniqueCustomID eq '081212')

The documents that have this custom column value are not being returned in the API response. What am I doing incorrectly?

2

There are 2 best solutions below

5
user2250152 On

You need to send POST request to /search/query endpoint.

In the body specify the type of entities to be searched and in the query you can scope the query to only those with unique custom id.

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

{
  "requests": [
    {
      "entityTypes": [
        "listItem"
      ],
      "query": {
        "queryString": "UniqueCustomID=081212"
      }
    }
  ]
}

"queryString": "UniqueCustomID=081212": = has meaning equals

"queryString": "UniqueCustomID:081212": : has meaning contains

Documentation

Search content in SharePoint

0
cb0008 On

The final solution involved this: