when I use device before Android 6.0 I have an error 400 bad request
I use code below:
DriveItemUploadableProperties driveItemUploadableProperties = new DriveItemUploadableProperties();
AdditionalDataManager additionalDataManager = driveItemUploadableProperties.getAdditionalDataManager();
additionalDataManager.put("@microsoft.graph.conflictBehavior", new JsonPrimitive("replace"));
driveItemUploadableProperties.name = file.getName();
FileSystemInfo fileSystemInfo = new FileSystemInfo();
fileSystemInfo.oDataType = "microsoft.graph.fileSystemInfo";
driveItemUploadableProperties.fileSystemInfo = fileSystemInfo;
final UploadSession uploadSession = mGraphServiceClient.getMe()
.getDrive()
.getItems(id)
.getItemWithPath(file.getName())
.getCreateUploadSession(driveItemUploadableProperties)
.buildRequest()
.post();
400 : Bad Request
[...]
[Some information was truncated for brevity, enable debug logging for more details]
at com.microsoft.graph.http.DefaultHttpProvider.handleErrorResponse(DefaultHttpProvider.java:357)
at com.microsoft.graph.http.DefaultHttpProvider.sendRequestInternal(DefaultHttpProvider.java:294)
at com.microsoft.graph.http.DefaultHttpProvider.send(DefaultHttpProvider.java:190)
at com.microsoft.graph.http.DefaultHttpProvider.send(DefaultHttpProvider.java:170)
at com.microsoft.graph.http.BaseRequest.send(BaseRequest.java:272)
at com.microsoft.graph.generated.BaseDriveItemCreateUploadSessionRequest.post(BaseDriveItemCreateUploadSessionRequest.java:43)
2019年06月04日10時32分31秒_0001111 is the file name. But when I name it with numbers and letters, it doesn't go wrong.
What's wrong in my code?
when I use device before Android 6.0 I have an error 400 bad request I use code below: DriveItemUploadableProperties driveItemUploadableProperties = new DriveItemUploadableProperties(); AdditionalDataManager additionalDataManager = driveItemUploadableProperties.getAdditionalDataManager(); additionalDataManager.put("@microsoft.graph.conflictBehavior", new JsonPrimitive("replace")); driveItemUploadableProperties.name = file.getName(); FileSystemInfo fileSystemInfo = new FileSystemInfo(); fileSystemInfo.oDataType = "microsoft.graph.fileSystemInfo"; driveItemUploadableProperties.fileSystemInfo = fileSystemInfo; final UploadSession uploadSession = mGraphServiceClient.getMe() .getDrive() .getItems(id) .getItemWithPath(file.getName()) .getCreateUploadSession(driveItemUploadableProperties) .buildRequest() .post();
Throwable detail: com.microsoft.graph.http.GraphServiceException: POST https://graph.microsoft.com/v1.0/me/drive/items/8C65BE0D41EC8BB3!15570:/2019年06月04日10時32分31秒_0001111.jpg:/microsoft.graph.createUploadSession SdkVersion : graph-android-v1.7.0 Authorization : bearer EwB4A8l6BAAURSN/FHlDW5xN74t[...] {"item":{"fileSystemInfo":{"@odata.type":"microsof[...]
2019年06月04日10時32分31秒_0001111 is the file name. But when I name it with numbers and letters, it doesn't go wrong. What's wrong in my code?