Independentsoft
Any library, any programming language
Home
Purchase
Support
Company
Contact
JGraph
>
Tutorial
> Move drive item
The following example shows you how to move a drive item to another folder.
import com.independentsoft.graph.GraphClient; import com.independentsoft.graph.GraphException; import com.independentsoft.graph.files.DriveId; import com.independentsoft.graph.files.DriveItem; import com.independentsoft.graph.files.ItemReference; public class Console { public static void main(String[] args) { try { GraphClient client = new GraphClient(); client.setClientId("63333333-209e-454e-b7bd-55a4d201270f"); client.setTenant("independentsoft.onmicrosoft.com"); client.setClientSecret("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); ItemReference destinationFolder = new ItemReference(); destinationFolder.setPath("/drive/root:/Folder2"); DriveItem movedItem = client.moveDriveItem("/Folder1/Test.pdf", "Test.pdf", destinationFolder, new DriveId("b!T7ZW_FMzJ02x_G6HteZHZ")); System.out.println("Item moved: " + movedItem.getName()); } catch (GraphException e) { System.out.println(e.getCode()); System.out.println(e.getMessage()); e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } }
Need help? Ask our developers:
Name*
Email*
Message*