I am using the OndeDrive sdk to perform some tests and I want to know if it is possible to create a folder from my app to OneDrive. Please give me a hand.
I am using the OndeDrive sdk to perform some tests and I want to know if it is possible to create a folder from my app to OneDrive. Please give me a hand.
Yes, it is possible. Using the SDK you can create the folder within a collection of elements by using the request constructors getDrive
, getItems
, and getChildren
with the create
method.
Parameters
| Name | Description |
| ---- | ----------- |
| folderToCreate | The folder you want to create. |
Example:
final String parentId = "0000000000000000000000";
final Item folderToCreate = new Item();
folderToCreate.name = "NewFolder";
folderToCreate.folder = new Folder();
final ICallback<Item> callback = new ICallback<Item> {
@Override
public void success(final Item result) {
Toast.makeText(getActivity(), "Created Folder", Toast.LENGTH_LONG).show();
}
...
// Handle failure
}
oneDriveClient
.getDrive()
.getItems(parentId)
.getChildren()
.buildRequest()
.create(folderToCreate, callback);