microsoftgraph / msgraph-sdk-javascript

Microsoft Graph client library for JavaScript
https://graph.microsoft.com
MIT License
730 stars 220 forks source link

Filtering items in drive by lastModifiedDateTime #1657

Closed NicolasEspiau-stilll closed 2 months ago

NicolasEspiau-stilll commented 3 months ago

Bug Report

Prerequisites

For more information, see the CONTRIBUTING guide.

Description

I'm trying to list the content of some folders in a given drive.
The basic list is ok:

  const result = await azClient.api(`/drives/${driveId}/items/${folderId}/children`)
    .top(1)
    .get()

But if I want to filter the result to get only the recently modified items I get an error:

  const result = await azClient.api(`/drives/${driveId}/items/${folderId}/children`)
    .header("ConsistencyLevel", "eventual")
    .filter("lastModifiedDateTime eq 2022-05-20T13:30:41Z")
    .top(1)
    .get()

returns GraphError: Invalid request with no more information
while:

  const result = await azClient.api(`/drives/${driveId}/items/${folderId}/children`)
    .header("ConsistencyLevel", "eventual")
    .filter("lastModifiedDateTime eq '2022-05-20T13:30:41Z'")
    .top(1)
    .get()

returns GraphError: Invalid filter clause: A binary operator with incompatible types was detected. Found operand types 'Edm.DateTimeOffset' and 'Edm.String' for operator kind 'Equal'.

Same thing with operators ge and le.

Steps to Reproduce

  1. Write a script with a correct authentication using ms graph client library
  2. Execute a call to list filtered items in a drive

Expected behavior: Get the list of children that has been modified according to the filter

Actual behavior: Error

Additional Context

Add any other context about the problem here..

Usage Information

Request ID - Value of the requestId field if you are receiving a Graph API error response 8ae09b78-49cb-4559-ae24-abb8de6bb5aa","client-request-id":"4664652e-9cda-0cef-5444-a865a17daa8f

SDK Version - 3.0.7

Node Version - 18.17.1

andrueastman commented 3 months ago

Thanks for raising this @NicolasEspiau-stilll

Any chance you are able to replicate the same on the graph explorer? I suspect the API does not support filter on this path at the moment.

microsoft-github-policy-service[bot] commented 3 months ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.