OneDrive / onedrive-sdk-android

OneDrive SDK for Android!
https://dev.onedrive.com
Other
148 stars 52 forks source link

Replacing of files #95

Closed OlegRy closed 8 years ago

OlegRy commented 8 years ago

Is it possible to replace file on drive? For example, I had photo on drive, which was downloaded to my app. In my app I've cropped photo and now I want upload cropped photo to drive using replacing. Is it possible to do that avoiding removing?

peternied commented 8 years ago

You can PUT against the content of a file, and it will replace the binary content of that file. It will update the relevant metadata on that item such as the size, but not alter any of the OneDrive metadata such as sharing links.

final byte[] replacementBinaryContent;
final ICallback<Item> contentReplacedCallback;
client.getDrive()
      .getItems("{Item-Id}")
      .getContent()
      .buildRequest()
      .put(replacementBinaryContent, contentReplacedCallback);
OlegRy commented 8 years ago

Good! Thanks!