Get a SharePoint 365 asset

Use the externalItem GraphQL query get a single SharePoint 365 asset, which includes files, folders and document libraries.

Entity types

The following are the supported entity types for SharePoint 365:
  • SharepointDrive
  • SharepointFile
  • SharepointFolder

Example request for a document library

The first sample code block illustrates a request to retrieve data about a SharePoint document library (we refer to it as a drive). The second code block illustrates the corresponding response with with the requested details, which in this case is simply the library's title.

RequestResponse
{
  externalItem(eclUri: "ecl:5-sharepoint-b!21;rf643eLuXEG6a-SharepointDrive-folder") {
    ... on SharepointDrive {
      title    
    }
  }
}
{
  "data": {
    "externalItem": {
      "title": "Documents"
    }
  }
}

Example request for a folder

Similar to the preceding example, the next example requests data about a SharePoint Folder:

RequestResponse
{
 externalItem(eclUri: "ecl:5-sharepoint-015ASHMII3ZTMENNoH-SharepointFolder-folder") {
    ... on SharepointFolder {
      title    
    }
  }
}
{
  "data": {
    "externalItem": {
      "title": "Tridion Test"
    }
  }
}

Example request for a file

The last example requests information on a single file, in this case an image, and the response includes a variety of image attributes:

RequestResponse
{
   externalItem(eclUri: "ecl:2-sharepoint-015ASHMIK6MtLNNoH-SharepointFile-file") {
    ... on SharepointFile {
      title     
      filename
      binaryReference
      thumbnail
      webUrl
      size
      contentType
    }
  }
}

{
  "data": {
    "externalItem": {
      "title": "landscape.jpg",
      "filename": "landscape.jpg",
      "binaryReference": "http://10.111.34.999:8081/cd/api/external/binary/sharepoint/eyJDblwZ/0156EAH",
      "thumbnail": "http://10.111.34.999:8081/cd/api/external/binary/sharepoint/eyJDb2W5/015ASK6",
      "webUrl": "https://my365.sharepoint.com/sites/Connector/Shared%20Documents/landscape.jpg",
      "size": 194177,
      "contentType": "image/jpeg"
    }
  }
}