Independentsoft
Professional software libraries for developers
Home
Purchase
Support
Company
Contact
Graph C++
>
Tutorial
> Move drive item
The following example shows you how to move a drive item to another folder.
C++ example
#include
#include "independentsoft/graph/graph_client.hpp" #include "independentsoft/graph/graph_exception.hpp" #include "independentsoft/graph/files/drive_item.hpp" #include "independentsoft/graph/files/item_reference.hpp" #include "independentsoft/graph/files/drive_id.hpp" using namespace independentsoft::graph; using namespace independentsoft::graph::files; int main() { try { GraphClient client; client.client_id = "63333333-209e-454e-b7bd-55a4d201270f"; client.tenant = "independentsoft.onmicrosoft.com"; client.client_secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; ItemReference destinationFolder; destinationFolder.path = "/Folder2"; DriveItem movedItem = sync_wait(client.move_drive_item("/Folder1/Test.pdf", "Test.pdf", destinationFolder, DriveId("b!T7ZW_FMzJ02x_G6HteZHZ"))); std::cout << "Name = " << movedItem.name << std::endl; } catch (const GraphException& ex) { std::cout << "Error: " << ex.code << std::endl; std::cout << "Message: " << ex.message << std::endl; } return 0; }
Need help? Ask our developers:
Name*
Email*
Message*