The M-Files Community will be updated on Tuesday, April 2, 2024 at 10:00 AM EST / 2:00 PM GMT and the update is expected to last for several hours. The site will be unavailable during this time.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

[SOLVED] Knowing if a vault is online

Former Member
Former Member

Hello,

Is there any way of knowing whether a vault is currently online or not?

I use views and it is not impossible for the user to switch his vault offline. I would prefer to detect the fact that it is offline and display an information message rather than a crash.

Is this possible?

Thanks !

-----------

VB.Net - version 4.7.2

M-Files client : 22.5.11436.3

Parents
  • How are you connecting to the vault?  Could you test the vault connection?
    M-Files API - VaultConnection Object

  • Former Member
    0 Former Member in reply to Craig Hawker

    I get all configured vaults with

    Dim client As MFilesClientApplication = New MFilesClientApplication()
    
    For Each vc As VaultConnection In client.GetVaultConnections()
        If (vc.ServerVaultGUID = guidVault) Then
            
            [...]
    
            Dim t1 = vc.IsLoggedIn()
            Dim t2 = vc.TestConnectionToVault(IntPtr.Zero)
            Exit For
        End If
    Next

    For the concerned vault, when is offline:

    • vc.IsLoggedIn() = true
    • myVault.TestConnectionToVault(IntPtr.Zero) = MFilesAPI.MFVaultConnectionTestResult.MFVaultConnectionTestResultOK

    --------

    EDIT 10h00 :

    I'm not deconnected from the network, and I can ping server.

    I just want show a message if a user has this vault offline.

  • I tested this, and it is awkward if the server is online but the vault offline.

    Can you wrap your call to BindToVault in a try/catch, and throw a suitable message to the user if it fails?

Reply Children