microsoftgraph / microsoftgraph/msgraph-sdk-php

Conflict Behavior cannot be set for Drive Item Copy

Offen
#1,555 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

dependency:metadata type:bug
Vorherrschende Sprache
PHP
Sterne
669
Forks
150
Ø Merge
15 Std. 21 Min.
Gemergte PRs (30 T.)
3

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit den generierten CopyRequestBuilderPostRequestConfiguration- und CopyPostRequestBody-Klassen und verwende die Reproduktionsanfrage aus dem Issue. Vergleiche das Verhalten der Kopieranfrage in den SDK-Versionen 2.10.0 und 1.110.0 und überprüfe anschließend, dass conflictBehavior=rename akzeptiert wird und eine in Konflikt stehende Zieldatei umbenennt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
php
Bereich
api
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.