Onedrive-api-docs: Feature Request: Add relationship between DriveItem and ListItem

Created on 12 Apr 2018  路  5Comments  路  Source: OneDrive/onedrive-api-docs

Currently, the API supports expanding a ListItem's related DriveItem but not the other way around.

So while we can do /lists/{id}/items?$expand=driveItem, we cannot do /drives/{id}/root/children?$expand=listItem.

This presents a problem when a Document Library contains additional metadata columns. Currently, there is no way to find the underlying ListItem to obtain this metadata.

question

All 5 comments

This should already work - you can see a listItem navigation property defined on the driveItem schema. What do you see when you try such a query?

Doh!

You are absolutely correct, when using $expand=listItem against the children collection it is returning the associated ListItem.

Where I got confused, and where it _isn't_ working as expected is /root/search(q='query')?$expand=listItem. This returns:

"error": {
    "code": "notSupported",
    "message": "The request is not supported by the system.",
    "innerError": {
        "request-id": "a44adc84-b3ad-4c66-ab20-d46693dbf263",
        "date": "2018-04-12T19:48:19"
    }
}

The relationship with ListItem is also currently undocumented. When I ran across the issue with searching I went back to the documentation to confirm this was missing and made an incorrect assumption. My apologies for the confusion.

Ah yeah, search is its own beast. We can only return the data that is part of the index, which doesn't include the vast majority of data that a developer would expect to see on a listItem.

Okay, that makes a lot of sense.

For the "wish list" pile, it would be helpful if the index could extend to include the ListItem. I've come across several examples where the developer is attempting to search a Document Library and needs to include additional metadata from the ListItem in the search result. At the moment the only option is to use the DriveItem identifier from the search results and make a subsiquent calls to get the full DriveItem and ListItem for each file. This ends up driving a lot of excess traffic for each search query.

We have a general work item to try and align the search and "normal" results, and hopefully we'll make progress over time.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

audiorecorder picture audiorecorder  路  5Comments

upxact picture upxact  路  9Comments

marcreicher picture marcreicher  路  3Comments

dluces picture dluces  路  3Comments

arsnyder16 picture arsnyder16  路  11Comments