//WebUploadFile "C:\file.txt", "http://server/folder/file.txt", "domain\user", "password"

//Use this function call and constant to upload a directory and all it's subdirectories
//Const basedir = "c:\temp"
//WebDownloadFile("", "http://localhost/FlexFilesOpDit01/CNT/C717/115/SLNKDWF.dll");
WebdavURL = "https://webdav.quawonen.com/Facilitor/";

//====================== WebDAV upload single file

// Let op: usernaam/wachtwoord wordt verderop as Basic echt gezet
WebDownloadFile("OU_Normale_gebruikers.csv", WebdavURL + "ADExport/OU_Normale_gebruikers.csv", "quawonen\sa_facilitor_webdav", "2uva8efregeTr&s");

//====================== WebDAV upload single file
function WebDownloadFile (file, url, user, pass)
{
    WScript.Echo("Downloading: " + url);
    objXMLHTTP = new ActiveXObject("MSXML2.ServerXMLHTTP")
    //var SXH_PROXY_SET_PROXY = 2;
    //objXMLHTTP.setProxy(SXH_PROXY_SET_PROXY, "127.0.0.1:8888");

    objXMLHTTP.open("GET", url, false, user, pass);
    objXMLHTTP.setRequestHeader('Authorization', 'Basic cXVhd29uZW5cc2FfZmFjaWxpdG9yX3dlYmRhdjoydXZhOGVmcmVnZVRyJnM=');

    objXMLHTTP.send(null);

    var oStream = new ActiveXObject("ADODB.Stream");
    oStream.Open;
    oStream.Type = 1;
    oStream.Write(objXMLHTTP.responseBody)
    oStream.SaveToFile(file, 2);
}
