I was to fetch files only from a specific date eg. lastModifiedDateTime.
I am using the below API call to get all items from the drive: (all the driveItems are fetched in the response.)
https://graph.microsoft.com/v1.0/drives/{drive-id}/root/children
response:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives('{drive-id}')/root/children",
"@odata.nextLink": "https://graph.microsoft.com/v1.0/drives/{drive-id}/root/children?$skiptoken={token}",
"value": [
{
"createdDateTime": "2021-04-22T14:55:50Z",
"eTag": "{tag}",
"id": "{id}",
"lastModifiedDateTime": "2021-04-22T14:55:50Z",
"name": "20",
"webUrl": "{webUrl}",
"cTag": "{tag}",
"size": 964153,
"createdBy": {
"user": {
"email": "{email-id}",
"id": "{id}",
"displayName": "XYZ"
}
},
"lastModifiedBy": {
"user": {
"email": "{email-id}",
"id": "{id}",
"displayName": "XYZ"
}
},
"parentReference": {
"driveId": "{drive-id}",
"driveType": "documentLibrary",
"id": "{parent-id}",
"path": "/drives/{drive-id}/root:"
},
"fileSystemInfo": {
"createdDateTime": "2021-04-22T14:55:50Z",
"lastModifiedDateTime": "2021-04-22T14:55:50Z"
},
"folder": {
"childCount": 3
}
} ]
}
I am using the below API to use filter on the above API call to get only files modified after '2021-04-22'
https://graph.microsoft.com/v1.0/drives/{drive-id}/root/children?$filter=lastModifiedDateTime eq '2021-05-22'
response:
{
"error": {
"code": "BadRequest",
"message": "Invalid filter clause",
"innerError": {
"date": "2021-05-05T20:49:26",
"request-id": "50ead21c-47fc-4b26-b36f-03d9be6e37fc",
"client-request-id": "50ead21c-47fc-4b26-b36f-03d9be6e37fc"
}
}
}