How to filter by createdDateTime Graph API 'me/drive/microsoft.graph.sharedWithMe'

Aishwarya Brahmankar 0 Reputation points
2024-05-21T11:48:06.3533333+00:00

Trying to filter the response by "createdDateTime", but always get an InvalidRequest.  Request: GET https://graph.microsoft.com/v1.0/me/drive/microsoft.graph.sharedWithMe?$filter=createdDateTime ge 2024-05-15T09:00:00Z

Response: 

{

    "error": {

        "code": "invalidRequest",

        "message": "Invalid request",

        "innerError": {

            "date": "2024-05-21T10:51:07",

            "request-id": "{request-id}",

            "client-request-id": "{client-request-id}"

        }

    }

}

Also need to add $filter on 'file/mimeType' to get the video/mp4 files, when using the  "/v1.0/me/drive/sharedWithMe" api endpoint.

Is the above syntax correct? how I can get the filtered data?

Any help or guidance on how to get the filtered data would be greatly appreciated!

Thanks

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
9,294 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,920 questions
OneDrive
OneDrive
A Microsoft file hosting and synchronization service.
882 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,922 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Hitesh Pachipulusu - MSFT 475 Reputation points Microsoft Vendor
    2024-05-21T12:24:09.9366667+00:00

    Hello @Aishwarya Brahmankar ,

    Thank you for contacting Microsoft Support.

    According to the documentation, you cannot use $filter with /drive, only $select can be used.

    Please refer https://learn.microsoft.com/en-us/graph/api/drive-get?view=graph-rest-beta&tabs=http#optional-query-parameters,

    https://learn.microsoft.com/en-us/answers/questions/60233/microsoft-graph-api-odata-fetch-drives-using-filte.

    Hope this helps.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments