Conflict Behavior cannot be set for Drive Item Copy

未关闭
#1,555 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
38/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
php
领域
api

调研方向

从生成的 CopyRequestBuilderPostRequestConfiguration 和 CopyPostRequestBody 类开始,使用 issue 中的复现请求。比较 SDK 2.10.0 和 1.110.0 版本中的复制请求行为,然后验证 conflictBehavior=rename 会被接受,并会重命名发生冲突的目标文件。

由索引模型根据 Issue 内容生成。

描述

dependency:metadata type:bug
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

主要语言
PHP
星标
669
派生
150
平均合并
15 小时 21 分钟
30 天内合并 PR
3

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoftgraph/msgraph-sdk-php 的其他 Issue

查看 microsoftgraph/msgraph-sdk-php 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。