<![CDATA[
/*
    $Id$

    File:       list_webhooks.wsf

    Calling:     cscript ..\..\..\utils\exchange\list_webhooks.wsf
    Parameters:
    Context:     Test only vanuit cust/Exchange folder
    Description: Toon de lopende webhook subscriptions
    Note:
*/
]]>

<job id="exchange_webhooks">
  <script language="JScript" src="../wsf_shared.js"/>
  <script language="JScript" src="../json2.js"/>
  <script language="JScript" src="ms_graph.js"/>

  <script language="JScript">
/* global */ var custabspath = fso.GetAbsolutePathName("../");

    var config = loadconfig("exchange.config");
    var token;
    var Oracle = new ActiveXObject("ADODB.Connection");
    Oracle.Open('File Name=../oracle.udl'); //../Oracle.udl
    token = requestToken(config);

    var request = {
      "method": "GET",
      "url": "https://graph.microsoft.com/v1.0/subscriptions",
      "headers": { "Accept": "application/json", "Authorization": "Bearer " + token },
      "params": { "callback": function (req, xhr) {
          WScript.Echo(JSON.stringify(xhr, null, 2))
        }
      }
    }
    doHTTP(request);
  </script>
</job>