microsoftgraph / microsoftgraph/msgraph-sdk-java

byDriveItemId.patch() returns 204 No Content and fails on OneDrive Personal Accounts

Đang mở
#2,546 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

status:waiting-for-triage type:bug
Ngôn ngữ chính
Java
Star
444
Fork
154
Merge trung bình
18 giờ 28 phút
Pull request đã merge (30 ngày)
4

Mô tả

Describe the bug

Using the graph sdk client I can't update (rename, move, or change any metadata) when I'm specifiying an itemId, instead of the path to the actual file.

Expected behavior

Works the same as on OneDrive Business.

How to reproduce
package com.microsoft;

import com.azure.core.credential.AccessToken;
import com.azure.core.credential.TokenCredential;
import com.azure.core.credential.TokenRequestContext;
import com.microsoft.graph.models.DriveItem;
import com.microsoft.graph.serviceclient.GraphServiceClient;
import java.time.OffsetDateTime;
import reactor.core.publisher.Mono;

public class App {
    public static void main(String[] args) {
        final GraphServiceClient graphClient = new GraphServiceClient(
                new TokenCredential() {
                    @Override
                    public Mono<AccessToken> getToken(TokenRequestContext request) {
                        return Mono.just(new AccessToken(
                                "***",
                                OffsetDateTime.now().plusDays(1)));
                    }
                });
        final DriveItem newMetadata = new DriveItem();
        newMetadata.setName("000");
        final DriveItem result = graphClient
                .drives().byDriveId("097…")
                .items().byDriveItemId("97…!s0c…")
                .patch(newMetadata);
        if (result instanceof DriveItem) {
            System.out.println(result.getName());
        } else {
            System.out.println("Patch returned null");
        }
    }
}
SDK Version

No response

Latest version known to work for scenario above?

Microsoft Graph REST API before 2025-11-12.

Known Workarounds

Using drives/{driveId}/root:/path/to/file to patch, but according to the documentation page using Item IDs is preferred, also this option isn't exposed in the Java Sdk.

Debug output
Click to expand log
> PATCH /v1.0/drives/097…/items/97…!s8… HTTP/1.1
> Accept: application/json
> Content-Type: application/json
> Transfer-Encoding: chunked
> Host: graph.microsoft.com
> Connection: Keep-Alive
> Accept-Encoding: gzip,deflate
> Authorization: ********
> Prefer: Include-Feature=AddToOneDrive
< HTTP/1.1 204 No Content
< Cache-Control: max-age=0, private
< Strict-Transport-Security: max-age=31536000
< request-id: d90b78b1-b92c-4038-8c44-f1dd39f9c8cd
< client-request-id: d90b78b1-b92c-4038-8c44-f1dd39f9c8cd
< x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"Germany West Central","Slice":"E","Ring":"4","ScaleUnit":"007","RoleInstance":"FR2PEPF00000F84"}}
< SPLogId: 65a8f6a1-e0bf-f000-6d60-d5c4d2d3abfd
< Date: Fri, 13 Feb 2026 18:53:07 GMT
Configuration

No response

Other information

This started failing around 2025-11-12.

Also: rclone/rclone#9150
https://github.com/iterate-ch/cyberduck/pull/17882
https://github.com/iterate-ch/onedrive-java-client/pull/53

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với lệnh gọi PATCH của GraphServiceClient sử dụng item-ID được hiển thị trong phần tái hiện và so sánh hành vi của nó với workaround dựa trên đường dẫn đã được tài liệu hóa. Tái hiện thao tác cập nhật trên một tài khoản OneDrive Personal, sau đó xác minh rằng các cập nhật sử dụng item-ID trả về DriveItem như mong đợi thay vì phản hồi 204 không thể sử dụng; không có tệp hoặc bài kiểm thử nào trong repository được nêu tên.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
api
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
38/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.