Hi,
I use your example and it's failed
/Initialize the file input stream and get the file size
InputStream file = new FileInputStream("File-Path");
long fileSize = file.available();
// Set the DriveItemUploadableProperties
// This is used to populate the request to create an upload session
DriveItemUploadableProperties driveItemUploadableProperties = new DriveItemUploadableProperties();
Map<String, Object> additionalData = new HashMap<>();
additionalData.put("@microsoft.graph.conflictBehavior", "replace");
driveItemUploadableProperties.setAdditionalData(additionalData);
// Finish setting up the request body
CreateUploadSessionPostRequestBody uploadSessionPostRequestBody = new CreateUploadSessionPostRequestBody();
uploadSessionPostRequestBody.setItem(driveItemUploadableProperties);
// Create the upload session
String myDriveId = graphClient.me().drive().get().getId();
UploadSession uploadSession = graphClient.drives()
.byDriveId(myDriveId)
.items()
.byDriveItemId("root:/fileName:")
.createUploadSession().post(uploadSessionPostRequestBody);
// Create the large file upload task
LargeFileUploadTask uploadTask =
new LargeFileUploadTask(graphClient.getRequestAdapter(),
uploadSession,
file,
fileSize,
DriveItemUploadableProperties::createFromDiscriminatorValue);
try{
UploadResult uploadResult = uploadTask.upload();
} catch(ApiException | InterruptedException exception) {
System.out.println(exception.getMessage());
}