Delta API appears to return incorrect parent folder id for OneDrive Business Accounts when the change is "deleted"

198 views Asked by At

When a file is deleted in a OneDrive business account (consumer account works fine) the delta response for 'GET /me/drive/root/delta?token=mytoken' reports the file as deleted however the parentReference/id is incorrect and lists the root folder id as it's parent when in reality the deleted file is child of a different folder.

For consumer accounts a delete on a folder will trigger 3 changes reported in delta api, the item deleted, it's parent folder, and the root folder. However for business accounts I only see 2 changes, the file (with incorrect parent id) and then the root folder.

I have no way of determining the parent folder for the deleted item since it always lists the root folder as parent.

Is this a bug or limitation of graph for business accounts ?

When adding a file in OneDrive business the delta command does return proper results, this only appears to be an issue when a file is deleted.

Here is the response to the command 'GET /me/drive/root/delta?token=MzslMjM0OyUyMzE7' The second element is returning the parent reference id as the same as the root folder, but it should be the id for a 'Subdir' folder

{
"value":[
    {
        "@odata.type":"#microsoft.graph.driveItem",
        "createdDateTime":"2020-03-29T12:01:50Z",
        "id":"017LHA5JNWSELRRZ",
        "lastModifiedDateTime":"2020-10-01T08:34:04Z",
        "name":"root",
        "webUrl":"https://srtoffice365-my.sharepoint.com/personal/john_srtoffice_com/Documents",
        "size":1052574847,
        "parentReference":{
            "driveId":"b!ae6hTdy-HkWA2plo",
            "driveType":"business"
            },
        "fileSystemInfo":{
            "createdDateTime":"2020-03-29T12:01:50Z",
            "lastModifiedDateTime":"2020-10-01T08:34:04Z"
            },
        "folder":{"childCount":18},
        "root":{},
    },
    {
        "@odata.type":"#microsoft.graph.driveItem",
        "id":"017LHA5JS5HPS6J2",
        "cTag":"\"c:{E5742615-E143-47FC-884D-55974EF9793A},4294967295\"",
        "size":0,
        "parentReference":{
            "driveId":"b!ae6hTdy-HkWA2plo",
            "driveType":"business",
        "id":"017LHA5JNWSELRRZ"},
        "deleted":{"state":"deleted"},
        "fileSystemInfo":{},
        "folder":{"childCount":0}
    }
]
}
0

There are 0 answers