上传同名 Microsoft Graph 文件时不替换现有文件 API
Do not replace existing file when uploading file with same name Microsoft Graph API
当我将文件上传到一个驱动器时,如何防止用同名的新文件替换现有文件?
我正在使用 PUT /me/drive/items/{parent-id}:/{filename}:/content
docs 终点。
相反,我需要继续索引 (test.jpg, test (1).jpg) 或者,就像 google 驱动器一样,添加两个同名文件。
您可以使用 Instance Attributes 控制此行为,特别是 @microsoft.graph.conflictBehavior
查询参数。支持三种冲突行为; fail
、replace
(默认值)和 rename
.
The conflict resolution behavior for actions that create a new item. You can use the values fail, replace, or rename. The default for PUT is replace. An item will never be returned with this annotation. Write-only.
为了让它自动重命名文件,您将 @microsoft.graph.conflictBehavior=rename
作为查询参数添加到您的 URI。
PUT /me/drive/items/{parent-id}:/{filename}:/content?@microsoft.graph.conflictBehavior=rename
当我将文件上传到一个驱动器时,如何防止用同名的新文件替换现有文件?
我正在使用 PUT /me/drive/items/{parent-id}:/{filename}:/content
docs 终点。
相反,我需要继续索引 (test.jpg, test (1).jpg) 或者,就像 google 驱动器一样,添加两个同名文件。
您可以使用 Instance Attributes 控制此行为,特别是 @microsoft.graph.conflictBehavior
查询参数。支持三种冲突行为; fail
、replace
(默认值)和 rename
.
The conflict resolution behavior for actions that create a new item. You can use the values fail, replace, or rename. The default for PUT is replace. An item will never be returned with this annotation. Write-only.
为了让它自动重命名文件,您将 @microsoft.graph.conflictBehavior=rename
作为查询参数添加到您的 URI。
PUT /me/drive/items/{parent-id}:/{filename}:/content?@microsoft.graph.conflictBehavior=rename