microsoft-graph-explorer-v4 icon indicating copy to clipboard operation
microsoft-graph-explorer-v4 copied to clipboard

GET /sites/{site-id}/drives/{drive-id}/items/ returns 500 error code generalException

Open vruss opened this issue 2 years ago • 0 comments

Describe the bug I'm trying to enumerate through all files available on all SharePoint drives.

When qurying for all DriveItems in a SharePoint drive using GET /sites/{site-id}/drives/{drive-id}/items/, a 400 error is returned telling me that filter is required. I can't find any documentation that mentions that GET /sites/{site-id}/drives/{drive-id}/items/ requires the filter query option.

So I supply a filter that will return all drive items like so:

https://graph.microsoft.com/v1.0/sites/{site-id}/drives/{drive-id}/items?$filter=name+ne+'x'

Which returns a 400 error like so:

{
    "error": {
        "code": "invalidRequest",
        "message": "Expand cannot be null or empty.",
        "innerError": {
            "date": "2022-09-16T06:10:41",
            "request-id": "3f9fb196-7bfd-42df-8128-19f454e0566e",
            "client-request-id": "6ed0a895-f84e-88d2-5707-5e776177fb04"
        }
    }
}

So I add a random expand:

https://graph.microsoft.com/v1.0/sites/{site-id}/drives/{drive-id}/items?$filter=name+ne+'x'&$expand=createdByUser

and it gives me this 400 error:

{
    "error": {
        "code": "invalidRequest",
        "message": "Expand either analytics($expand=allTime) or analytics($expand=lastSevenDays) is required.",
        "innerError": {
            "date": "2022-09-16T06:13:29",
            "request-id": "000b2108-b8c3-45e2-9c37-99a26ffd465a",
            "client-request-id": "ba57ccbb-43f8-3389-fbe8-dbd15faef889"
        }
    }
}

So I change it to use the required expand:

https://graph.microsoft.com/v1.0/sites/{site-id}/drives/{drive-id}/items?$filter=name+ne+'x'&$expand=analytics($expand=lastSevenDays)

Which results in this 500 error:

{
    "error": {
        "code": "generalException",
        "message": "General exception while processing",
        "innerError": {
            "date": "2022-09-16T06:14:33",
            "request-id": "5cbdf340-ee85-4578-9437-6924de6312bb",
            "client-request-id": "07c72c89-32d8-0e66-7d1d-3e10ab20cb30"
        }
    }
}

To Reproduce Steps to reproduce the behavior:

  1. Go to https://developer.microsoft.com/en-us/graph/graph-explorer
  2. Use API version v1
  3. Follow the steps I did above^

Expected behavior I want all driveItems to be returned to me when I call GET /sites/{site-id}/drives/{drive-id}/items/ with or without query options.

vruss avatar Sep 16 '22 06:09 vruss