Documentation Center

Search SharePoint 365 content

In addition to listing items, you can use the externalItems GraphQL query to search for and retrieve SharePoint 365 assets based on matching search text.

Example request

The first sample code block illustrates a request to retrieve SharePoint files that include a specified text string.

{ externalItems(namespace:
  "sharepoint",
  filter: {
    context:
    { id: "b!rf643eLuXEG6ab2z"
      type: "sharepointDrive" }
    searchText:"landscape"
  })
  { edges {
     node {
      ...
      on sharepointFile { title binaryReference }
    }  
  }    
  }
}

Example response

The second code block illustrates the corresponding response with the matching files along with the requested details, title and the binary reference.

{
  "data": {
    "externalItems": {
      "edges": [
        {
          "node": {
            "title": "landscape.jpg",
            "binaryReference": "http://10.111.34.999:8081/cd/api/external/binary/null/eyJDb250Z/015ASHMIK6E "
          }
        },
        {
          "node": {
            "title": "Safety and Installation Manual.pdf",
            "binaryReference": "http://10.111.34.999:8081/cd/api/external/binary/null/eyJDb250Z50/015ASHMIKBN"
          }
        }
      ]
    }
  }
}