Hello
I’m starting to learn OLE object Outlook. I’d like to see if Outlook is connected to the internet but I couldnt find any properties that check for this on Microsfot
guides.
Any ideas on how to do it ? thanks
There are other methods, here’s a web access check for 2019r2, if you want a network access check (the two aren’t always the same) see https://forum.xojo.com/5104-checking-internet-connection/p3#p406540 but that might be english language dependent (I haven’t checked)
Public Function isConnected() as Boolean
#Pragma BreakOnExceptions 'So we can run in the IDE without stopping
Try
Dim u As New URLConnection
Dim s As String = u.SendSync("GET", "http://google.com/generate_204", 5) 'We have 5 seconds to check
Break
If s = "" And u.HTTPStatusCode = 204 Then
Return True
Else
Return False
End If
Catch err As RuntimeException
Return False
End Try
End Function