Code: Select all
Function isConnected(givenConf As Boolean) As Boolean
' In the below row, substitute XXXXXXX with your ServerName
Dim apiHeader As String: apiHeader = "/tm1/XXXXXXX/api/v1/ActiveSession/User/IsActive"
Dim apiResponse As Object
If Reporting.ActiveConnection Is Nothing Then
Exit Function
Else
Set apiResponse = Reporting.ActiveConnection.Get(apiHeader)
End If
If apiResponse Is Nothing Then
Exit Function
End If
If apiResponse.Properties.Item("value").Value = "true" Then
isConnected = True
Else
Exit Function
End If
End Function
Take care.