microsoftgraph / microsoftgraph/msgraph-sdk-php
Conflict Behavior cannot be set for Drive Item Copy
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 try to copy a file from folder A to folder B and I try to use @microsoft.graph.conflictBehavior but the request does not allow query parameters and it doesn't work if I add it to the body.
Expected behavior
I expected CopyRequestBuilderPostRequestConfiguration to have query options. Or for the CopyPostRequestBody->setAdditionalData(['@microsoft.graph.conflictBehavior' => 'rename']) to work.
How to reproduce
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Drives\Item\Items\Item\Copy\CopyPostRequestBody;
use Microsoft\Graph\Generated\Models\ItemReference;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new CopyPostRequestBody();
$parentReference = new ItemReference();
$parentReference->setDriveId('6F7D00BF-FC4D-4E62-9769-6AEA81F3A21B');
$parentReference->setId('DCD0D3AD-8989-4F23-A5A2-2C086050513F');
$requestBody->setParentReference($parentReference);
$requestBody->setAdditionalData(['@microsoft.graph.conflictBehavior' => 'rename']);
$result = $graphServiceClient->drives()->byDriveId('drive-id')->items()->byDriveItemId('driveItem-id')->copy()->post($requestBody)->wait();
When there is already a file in the destination folder with the same name it doesn't do anything instead of renaming the new file.
SDK Version
2.10.0
Latest version known to work for scenario above?
1.110.0
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 with the generated CopyRequestBuilderPostRequestConfiguration and CopyPostRequestBody classes, using the reproduction request in the issue. Compare the copy request behavior in SDK versions 2.10.0 and 1.110.0, then verify that conflictBehavior=rename is accepted and renames a conflicting destination file.
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
- 38/100