Copying File to another sharepoint destination
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu với điểm vào DriveItem copy().post(...) và tài liệu Microsoft Graph driveItem copy được liên kết trong issue. Tái hiện kịch bản bằng mã source, destination, ItemReference và CopyPostRequestBody được cung cấp, sau đó xác định tại sao việc thay thế không được áp dụng và tại sao post() trả về null. Hoàn tất khi hành vi sao chép được báo cáo và giá trị trả về đã được giải thích hoặc sửa lỗi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
HI ,
I am copying a file from my sharepoint site to another location on the same site.
The first time i execute the code the file is copied correctly.
When i change the file content in the source folder and copy it again the code executes without errors but
the new file is not copied. In the destination folder there is still the file that was initialy copied.
I read the docs : https://learn.microsoft.com/en-us/graph/api/driveitem-copy?view=graph-rest-1.0&tabs=http
According to the docs i can use @microsoft.graph.conflictBehavior to replace the file in the destination but this does not work. The file is only copied once. When i delete the file in the destination the file is copied again.
This is the code i use.
Be sure that the referenced ids in the snipplet are fine and that in copyPostRequestBody the copyPostRequestBody.setParentReference(itemRefDestination); is set correctly.
DriveItem created = authenticationProvider.getGraphServiceClient().drives().byDriveId(driveRoot.getId()).items()
.byDriveItemId(driveItem.getId()).copy()
.post(copyPostRequestBody);
The other question i have here is: Why is "DriveItem created" always null ? According to the SDK post(...) returns a DriveItem. No matter if the copy is made (in the first place) or not the returned object is always null.
How can i make sure that changes made on the file in the source folder are always copied?
Expected behavior
I expect the file to be copied and the conflict behaviour provided is applied. As in when "replace" than its replaced , when "rename" the file is renamed in the destination.
How to reproduce
// get the source file as DriveItem
DriveItem sourceItem= driveItemManager.getDriveItemByPath(source.getPath());
// get the destination location as DriveItem
DriveItem destinationRoot = driveItemManager.getDriveItemByPath(destination.getPath());
// create ItemReference from destination root.
ItemReference itemRefDestination = new ItemReference();
itemRefDestination.setDriveId(driveItemDest.getParentReference().getDriveId());
itemRefDestination.setId(driveItemDest.getId());
itemRefDestination.setName(destination.getName());
// create CopyPostRequestBody and set reference.
CopyPostRequestBody copyPostRequestBody = new CopyPostRequestBody();
copyPostRequestBody.setParentReference(itemRefDestination);
//execute the copy call -> myDriveId
DriveItem post = authenticationProvider.getGraphServiceClient().drives().byDriveId(myDriveId).items()
.byDriveItemId(sourceItem.getId()).copy()
.post(copyPostRequestBody);
SDK Version
6.33.0
Latest version known to work for scenario above?
5.80.0
Known Workarounds
No response
Debug output
Click to expand log
```</details>
### Configuration
Windows 11
### Other information
_No response_
- 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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoftgraph/msgraph-sdk-java
-
status:waiting-for-triage type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
microsoftgraph/msgraph-sdk-java#2610 ·
-
status:waiting-for-triage type:bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
microsoftgraph/msgraph-sdk-java#2656 ·
-
status:waiting-for-triage type:bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
microsoftgraph/msgraph-sdk-java#2654 ·
-
status:waiting-for-triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
microsoftgraph/msgraph-sdk-java#2639 ·
-
Error in PATCH onlineMeeting Đang mởstatus:waiting-for-triage type:bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
microsoftgraph/msgraph-sdk-java#2589 · 1 bình luận ·
Tất cả issue của microsoftgraph/msgraph-sdk-java
Issue tương tự
-
Bug Java Platform: Java
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
getsentry/sentry-java#6138 · 1 bình luận ·
-
bug needs triage p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
GoogleCloudPlatform/DataflowTemplates#4273 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
bug needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100