Quantcast
Channel: VMware Communities : Discussion List - Virtual Disk Development Kit
Viewing all articles
Browse latest Browse all 2039

Vb.net Vsphere SDK - Check if Connection is Valid after timeout

$
0
0



Hi everyone!


    Anyone know of a way to check if my Client connection is valid before I get a {VMware.Vim.NotAuthenticated} on FindEntityView line? I would like to check before having to resort to Catch Ex as Vmware.VimFault exception!?


Thanks!!


-NHALL

     


Public Function GetVMFolder(ByVal VMFolderName As String) As VMware.Vim.ManagedObjectReference



        Try



            If VMFolders Is Nothing Then



                VMFolders = Client.FindEntityViews(GetType(VMware.Vim.Folder), Nothing, Nothing, Nothing)



                Dim I As Integer = 0



                For Each tmp As VMware.Vim.Folder In VMFolders



                    Debug.WriteLine(I & ") " & tmp.Name)



                    I += 1



                Next



            End If



            For Each tmp As VMware.Vim.Folder In VMFolders



                If tmp.Name = VMFolderName Then



                    Return tmp.MoRef



                End If



            Next



        Catch ex As Exception



            Return Nothing



        End Try



    End Function


     /code


Viewing all articles
Browse latest Browse all 2039

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>