GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||
GeezerVison is showing github.com — docs: fix the 'list all items in a drive' sample (#1070) by earbona23 · Pull Request #1572 · microsoftgraph/msgraph-sdk-python ConversationFixes #1070 (and the earlier #365, which was closed without a fix). The bugSample 3 in items = await client.drives.by_drive_id('DRIVE_ID').items.get() # GET /drives/{id}/items
The SDK and Graph are both behaving correctly; the sample documented a call that cannot The fixSample 3 now does what its title says — list all the items — by walking page = await client.drives.by_drive_id('DRIVE_ID').items.by_drive_item_id('root').delta.get() while page: if page.value: for item in page.value: print(item.id, item.name, item.size, item.folder, item.file) if not page.odata_next_link: break page = await client.drives.by_drive_id('DRIVE_ID').items.by_drive_item_id('root').delta.with_url(page.odata_next_link).get() This also removes an overlap: as written, sample 3 duplicated sample 6 (which lists only the Verified against the generated SDK in this repo
Docs-only, one file. I did not run it against a live drive (no tenant), so if a maintainer
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions…microsoftgraph#365) Sample 3 called `client.drives.by_drive_id(id).items.get()`, i.e. `GET /drives/{id}/items`. That path is not an enumerable collection in Microsoft Graph — it addresses driveItems by id and only answers `$filter` queries — so the sample fails at runtime with `The 'filter' query option must be provided.` This has been reported repeatedly (microsoftgraph#365, closed without a fix, and microsoftgraph#1070 with nine reactions), while the broken sample stayed in the docs. Replace it with a correct, and now distinct, sample: enumerate every item in the drive by walking `root` with `delta`, paging through `odata_next_link`. That matches the section's title ("list ALL the items") and no longer overlaps with sample 6, which lists only the top level via `root/children`. A cross-reference between the two makes the distinction explicit. Verified against the generated SDK in this repo: `items.by_drive_item_id('root').delta`, its `with_url()` for paging, and `odata_next_link` / `value` on the delta response all exist. The snippet parses as valid Python.
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page.
Author
All reactions
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. This branch has not been deployedNo deployments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Error: The 'filter' query option must be provided.Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. | ||
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |