microsoftgraph / microsoftgraph/msgraph-sdk-php
PUT File upload through SDK does has no space for the new file name
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 669
- Forks
- 150
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 3
Description
Describe the bug
I am trying up upload a file using the SDK, resulting in:
$graphClient->drives()->byDriveId($driveId)->items()->byDriveItemId($itemId.':/'.$filename.':')->content()->put(Utils::streamFor($fileContent))->wait();
As you can see I have to abuse the byDriveItemId DriveId, because the underlying code calls for the url template: {+baseurl}/drives/{drive%2Did}/items/{driveItem%2Did}/content{?%24format*} Which does not allow for the use of the filename, as described in https://learn.microsoft.com/en-us/graph/api/driveitem-put-content?view=graph-rest-1.0&tabs=http where it should use the url PUT /drives/{drive-id}/items/{parent-id}:/{filename}:/content
Expected behavior
I expect the SDK to support an option somewhere to supply the filename in a correct way, instead of having to string combine it.
How to reproduce
Uploading a file trough the supplied SDK methods as described above
SDK Version
2.12.0
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
No response
Configuration
No response
Other information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the SDK request path behind ->content()->put() and compare its generated URL with the Microsoft Graph driveItem upload endpoint described in the issue. Trace how drive item identifiers are inserted into the URL template, then verify that a filename option produces the documented parent-id:/filename:/content request without string-combining the identifier.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100