Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Mono C#.NET Core C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicCkPythonChilkat2-PythonRubySQL ServerSwift 2Swift 3/4TclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.jsExcelGo

Unicode C++ Web API Examples

Primary Categories

AWS Translate
Activix CRM
Adyen
Amazon MWS
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Bluzone
CardConnect
ClickBank
Clickatell
Cloudfare
DocuSign
ETrade
Etsy
Facebook
GeoOp
GetHarvest
Jira
MYOB

Magento
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Okta OAuth/OIDC
OneLogin OIDC
PayPal
Peoplevox
Populi
QuickBooks
SOAP finkok.com
Shippo
Shopify
Stripe
SugarCRM
Trello
Twitter
VoiceBase
Vonage
Walmart
Walmart v3
Xero
eBay
effectconnect

 

 

 

(Unicode C++) Get Tasks for User

Demonstrates how to retrieve a list of plannertask objects assigned to a User.

See https://docs.microsoft.com/en-us/graph/api/planneruser-list-tasks?view=graph-rest-1.0 for more information.

Chilkat C/C++ Library Downloads

MS Visual C/C++

Linux/CentOS C/C++

Alpine Linux C/C++

MAC OS X C/C++

armhf/aarch64 C/C++

C++ Builder

iOS C/C++

Android C/C++

Win Mobile 5.0/Pocket PC 2003

Solaris C/C++

FreeBSD C/C++

OpenBSD C/C++

MinGW C/C++

#include <CkHttpW.h>
#include <CkJsonObjectW.h>

void ChilkatSample(void)
    {
    // This example requires the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    CkHttpW http;

    // The Microsoft Planner REST API requires an OAuth2 token with the Group.ReadWrite.All scope.
    // Use your previously obtained access token as shown here:
    //    Get Microsoft Graph OAuth2 Access Token with Group.ReadWrite.All scope.

    CkJsonObjectW jsonToken;
    bool success = jsonToken.LoadFile(L"qa_data/tokens/msGraphGroup.json");
    if (success == false) {
        wprintf(L"%s\n",jsonToken.lastErrorText());
        return;
    }

    http.put_AuthToken(jsonToken.stringOf(L"access_token"));

    // Send a GET request to https://graph.microsoft.com/v1.0/me/planner/tasks
    const wchar_t *strResponse = http.quickGetStr(L"https://graph.microsoft.com/v1.0/me/planner/tasks");
    if (http.get_LastMethodSuccess() == false) {
        wprintf(L"%s\n",http.lastErrorText());
        return;
    }

    CkJsonObjectW json;
    json.Load(strResponse);
    json.put_EmitCompact(false);

    if (http.get_LastStatus() != 200) {
        wprintf(L"%s\n",json.emit());
        wprintf(L"Failed, response status code = %d\n",http.get_LastStatus());
        return;
    }

    wprintf(L"%s\n",json.emit());

    // Sample output:
    // (See parsing code below..)

    // {
    //   "value": [
    //     {
    //       "createdBy": {
    //         "user": {
    //           "id": "6463a5ce-2119-4198-9f2a-628761df4a62"
    //         }
    //       },
    //       "planId": "xqQg5FS2LkCp935s-FIFm2QAFkHM",
    //       "bucketId": "gcrYAaAkgU2EQUvpkNNXLGQAGTtu",
    //       "title": "title-value",
    //       "orderHint": "9223370609546166567W",
    //       "assigneePriority": "90057581\"",
    //       "createdDateTime": "2015-03-25T18:36:49.2407981Z",
    //       "assignments": {
    //         "fbab97d0-4932-4511-b675-204639209557": {
    //           "@odata.type": "#microsoft.graph.plannerAssignment",
    //           "assignedBy": {
    //             "user": {
    //               "id": "1e9955d2-6acd-45bf-86d3-b546fdc795eb"
    //             }
    //           },
    //           "assignedDateTime": "2015-03-25T18:38:21.956Z",
    //           "orderHint": "RWk1"
    //          }
    //       },
    //       "id":"01gzSlKkIUSUl6DF_EilrmQAKDhh"
    //     }
    //   ]
    // }

    int i;
    int count_i;
    const wchar_t *createdByUserId = 0;
    const wchar_t *planId = 0;
    const wchar_t *bucketId = 0;
    const wchar_t *title = 0;
    const wchar_t *orderHint = 0;
    const wchar_t *assigneePriority = 0;
    const wchar_t *createdDateTime = 0;
    const wchar_t *assignments_odataType = 0;
    const wchar_t *assignmentsAssignedByUserId = 0;
    const wchar_t *assignmentsAssignedDateTime = 0;
    const wchar_t *assignmentsOrderHint = 0;
    const wchar_t *id = 0;

    i = 0;
    count_i = json.SizeOfArray(L"value");
    while (i < count_i) {
        json.put_I(i);
        createdByUserId = json.stringOf(L"value[i].createdBy.user.id");
        planId = json.stringOf(L"value[i].planId");
        bucketId = json.stringOf(L"value[i].bucketId");
        title = json.stringOf(L"value[i].title");
        orderHint = json.stringOf(L"value[i].orderHint");
        assigneePriority = json.stringOf(L"value[i].assigneePriority");
        createdDateTime = json.stringOf(L"value[i].createdDateTime");

        CkJsonObjectW *jsonA = json.ObjectOf(L"value[i].assignments");
        const wchar_t *userId = jsonA->nameAt(0);
        CkJsonObjectW *jsonUserA = jsonA->ObjectOf(userId);
        assignments_odataType = jsonUserA->stringOf(L"\"@odata.type\"");
        assignmentsAssignedByUserId = jsonUserA->stringOf(L"assignedBy.user.id");
        assignmentsAssignedDateTime = jsonUserA->stringOf(L"assignedDateTime");
        assignmentsOrderHint = jsonUserA->stringOf(L"orderHint");
        delete jsonUserA;
        delete jsonA;

        id = json.stringOf(L"value[i].id");
        i = i + 1;
    }

    wprintf(L"Success.\n");
    }

 

© 2000-2019 Chilkat Software, Inc. All Rights Reserved.