msgraph-sdk-php icon indicating copy to clipboard operation
msgraph-sdk-php copied to clipboard

PUT File upload through SDK does has no space for the new file name

Open RikvanderLinde opened this issue 1 year ago • 1 comments

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

RikvanderLinde avatar Sep 03 '24 14:09 RikvanderLinde

Hi @RikvanderLinde, thank you for your feedback and glad that you found a workaround. To try and reduce the size of the generated library, we are generating a slightly limited set of canonical paths and will look into considering this.

Ndiritu avatar Sep 30 '24 11:09 Ndiritu