microsoftgraph / msgraph-sdk-android

Microsoft Graph SDK for Android! https://graph.microsoft.io
Other
51 stars 43 forks source link

Uploading a LARGE file #117

Closed andycass closed 4 years ago

andycass commented 4 years ago

i have been using using:- {implementation('com.microsoft.graph:msgraph-sdk-android:1.6.0')

The docs for the newer sdk are non existant:- {implementation('com.microsoft.graph:msgraph-sdk-android:1.7.0')

Could you please provide java code relating to the Resumable Upload File:- https://docs.microsoft.com/en-us/graph/api/driveitem-createuploadsession?view=graph-rest-1.0

The file does not complete i want to overwrite the old file here is my code:-

val stream: InputStream = FileInputStream(path) val props = DriveItemUploadableProperties() val additionalData = props.additionalDataManager additionalData["@microsoft.graph.conflictBehavior"] = JsonPrimitive("replace"); // POST /me/drive/items/{itemId}/createUploadSession val uploadSession = mClient?.me?.drive?.getItems(mId)?.getCreateUploadSession(props)?.buildRequest()?.post() Log.d(TAG, "Upload Session ${uploadSession?.rawObject}") val uploadUrl = uploadSession?.uploadUrl val provider = ChunkedUploadProvider<DriveItem>(uploadSession, mClient, stream, stream.available(), DriveItem::class.java) val maxChunkSize = 320 * 1024; // 320 KB - Change this to your chunk size. 5MB is the default. provider.upload(null, callback, maxChunkSize)

I have included the SCOPES (In the Auth request):- private String[] mScopes = { "Files.ReadWrite", "User.Read", "Application.Read.All", "Files.Read.All", "Files.ReadWrite.All", "openid", "offline_access" };

In the azure portal i have added Files.ReadWrite.All And granted admin consent

Could you please provide an updated example in java please with the required request options "@microsoft.graph.conflictBehavior": "rename",

baywet commented 4 years ago

Hi everyone, Thank you for the contribution, we have moved away from an android specific SDK to a Java SDK and this repo will be archived very soon. If you're still facing the same issue with the Java SDK, feel free to re-open an issue over there. Closing.