I've made a process in Power Automate which I want to launch from VBA. The flow responds to a HTTP request and is working fine in chrome using the code:
http = new XMLHttpRequest;
http.open("POST","https://prod-32.westeurope.logic.azure.com:443/workflows/####/triggers/manual/paths/invoke?####");
http.setRequestHeader("Content-Type","application/json");
http.send('{"identity":"test","usage":["asdf"]}');
In chrome this code executes successfully. I also tested this code:
- In internet explorer, from a webpage which is a file on the desktop - this fails with "Access is denied"
- In internet explorer, from a website e.g. azure.com - this succeeds.
In VBA I do the following:
Dim http As Object
Set http = CreateObject("WinHttp.WinHttpRequest.5.1")
Call http.Open("POST", "https://prod-32.westeurope.logic.azure.com:443/workflows/####/triggers/manual/paths/invoke?####", False)
Call http.setRequestHeader("Content-Type", "application/json")
sData = "{""identity"":""test"",""usage"":[""asdf""]}"
Call http.send(sData)
When running the code from VBA, there is a lag spike, and then VBA responds with "The operation timed out" looking in Power Automate, there is no evidence that the HTTP Request was ever received as the request does not appear in the run history. Are there any caveats to using the HTTP requests in Microsoft flow?
Perhaps this is because like IE VBA is not "online" and thus is getting a CORS error? Not really sure how I can debug this issue... Any ideas?
Edit: A bit of an update on this, I believe this might be because of my company's proxy that is used. Unfortunately I'm not sure WinHttp.WinHttpRequest supports this, but I know Tim Hall's web request library does appear to.