Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Error] sites get_by_path_with_path is not working with invalid request.

Open
#279 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
api

Research direction

Start by reproducing the Python call to get_by_path_with_path with the supplied SharePoint path and inspect the request it sends to Microsoft Graph. Compare the encoded path and returned invalidRequest response with the expected API request; done means the download succeeds or the SDK limitation and required usage are documented.

Written by the indexing model from the issue text.

Description

bug dependency:metadata

Client id and secret was made with having API permission as below.

Files.Read.All
Files.ReadWrite.All
Sites.FullControl.All

What I want to download file of URL is https://mngenvmcap115298.sharepoint.com/sites/sampleteam/Shared%20Documents/general/PDF-ER.docx

async def getfile():
    file = await client.sites.by_site_id("0aa18ca9-16b0-4673-abf0-b14ec9649ee4").get_by_path_with_path("/Shared%20Documents/General/PDF-ER.docx").get()
    return file

value = asyncio.run(getfile())

error is here

{"message": null, "response_status_code": 400, "response_headers": "Headers({'cache-control': 'no-store, no-cache', 'transfer-encoding': 'chunked', 'content-type': 'application/json', 'content-encoding': 'gzip', 'vary': 'Accept-Encoding', 'strict-transport-security': 'max-age=31536000', 'request-id': 'ec72f171-946a-4628-8d06-1cc51cd368ce', 'client-request-id': '6b0d9456-23c7-4633-af1a-91cfca73d637', 'x-ms-ags-diagnostic': '{\"ServerInfo\":{\"DataCenter\":\"Japan East\",\"Slice\":\"E\",\"Ring\":\"5\",\"ScaleUnit\":\"000\",\"RoleInstance\":\"TY1PEPF0000A88F\"}}', 'date': 'Tue, 01 Aug 2023 08:38:04 GMT'})", "additional_data": {}, "error": {"additional_data": {}, "code": "invalidRequest", "details": null, "inner_error": {"additional_data": {"date": "8:38:05"}, "client_request_id": "6b0d9456-23c7-4633-af1a-91cfca73d637", "date": null, "odata_type": null, "request_id": "ec72f171-946a-4628-8d06-1cc51cd368ce"}, "message": "Invalid request", "target": null}}

How can I resolve?

Using msgraph-core 1.0.0a4, msgraph-sdk 1.0.0a13 which might be latest since I installl it today. WSL2, Python 3.10.12

Dominant language
Python
Stars
630
Forks
96
Avg merge
15h 20m
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoftgraph/msgraph-sdk-python

All issues in microsoftgraph/msgraph-sdk-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.