R – Post data from VBscript

vbscript

I have a function that need to accept two parameters- user and folder! I call that function from VBscript, and parameters need to be send with post method. This is the Vbscript function code from where I want to post data:

Sub loadDocument()
Const HOST = "http://192.168.0.144/webservice13/service1.asmx/Lock?User="& PC\User & "folder="&c:\foldername
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.open  "POST",HOST 
xmlhttp.send ""
End Sub

Now when i try to execute this function i getting error message that i have syntax error!
I assume that error is in this line:

Const HOST = "http://192.168.0.144/webservice13/service1.asmx/Lock?User="& PC\User & "folder="&c:\foldername

How I can resolve this, how i can post two variables to this function?
Thanks!

Best Answer

I think you cannot declare a Const variable with variable parts. Change the line to

dim userVar, folderVar, HOST

userVar = "PC\User"
folderVar = "c:\foldername"

HOST = "http://192.168.0.144/webservice13/service1.asmx/Lock?User=" & userVar & "&folder=" & folderVar
Related Topic