Independentsoft
Professional software libraries for developers
Home
Purchase
Support
Company
Contact
Graph C++
>
Tutorial
> Get lists in a site
The following example shows you how to get the collection of lists for a site.
C++ example
#include
#include
#include "independentsoft/graph/graph_client.hpp" #include "independentsoft/graph/graph_exception.hpp" #include "independentsoft/graph/util.hpp" #include "independentsoft/graph/sites/list.hpp" using namespace independentsoft::graph; using namespace independentsoft::graph::sites; int main() { try { GraphClient client; client.client_id = "63333333-209e-454e-b7bd-55a4d201270f"; client.tenant = "independentsoft.onmicrosoft.com"; client.username = "info@independentsoft.onmicrosoft.com"; client.password = "password"; std::vector
lists = sync_wait(client.get_lists("independentsoft.sharepoint.com,3333333-c666-4b40-bcd4-d771fb97ae69,73b98e9e-5749-407a-82b1-31d82fb30539")); for (const List& list : lists) { std::cout << "Id: " << list.id << std::endl; std::cout << "Name: " << list.name << std::endl; std::cout << "DisplayName: " << list.display_name << std::endl; std::cout << "CreatedTime: " << Util::to_universal_time(list.created_time) << std::endl; std::cout << "WebUrl: " << list.web_url << std::endl; std::cout << "-----------------------------------------------------------------" << 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*