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

Quick Refresh External Objects with VBScript

Former Member
Former Member
Hi all,

I want to setup VBScript to a scheduler that performs a quick refresh on external objects at given intervals.

Does anyone have some examples or guidance on how to do this?

Best Regards,
Conny
Parents
  • Former Member
    Former Member
    Thank you for your reply Joonas.

    I managed to get the script done with searching the forums here and looking into the API documentation.

    The registry settings update requires users to view or edit the objects in order to sync, so we needed a VBScript.
    Place the .vbs in a folder on your server and have the client connection setup. The name of the vault should be the same as in the script.

    Here is the code for doing a quick refresh:

    ' Initialize the MFilesClientApplication object.
    Dim oClientApp: Set oClientApp = CreateObject("MFilesAPI.MFilesClientApplication")
    ' Log into a vault through a document vault connection "Your Vault".
    Dim oVault: Set oVault = oClientApp.BindToVault("Your Vault", 0, true, false)

    '0 = MFExternalDBRefreshTypeNone No refresh is performed.
    '1 = MFExternalDBRefreshTypeQuick The quick refresh searches for new items and imports them to M-Files.
    '2 = MFExternalDBRefreshTypeFull The full refresh updates all the changes. This operation can take several minutes.

    oVault.ObjectTypeOperations.RefreshExternalObjectType 102, 1 'where "102" is the object ID that you want refreshed and "1" is quick refresh.


    Best Regards,
    Conny
Reply
  • Former Member
    Former Member
    Thank you for your reply Joonas.

    I managed to get the script done with searching the forums here and looking into the API documentation.

    The registry settings update requires users to view or edit the objects in order to sync, so we needed a VBScript.
    Place the .vbs in a folder on your server and have the client connection setup. The name of the vault should be the same as in the script.

    Here is the code for doing a quick refresh:

    ' Initialize the MFilesClientApplication object.
    Dim oClientApp: Set oClientApp = CreateObject("MFilesAPI.MFilesClientApplication")
    ' Log into a vault through a document vault connection "Your Vault".
    Dim oVault: Set oVault = oClientApp.BindToVault("Your Vault", 0, true, false)

    '0 = MFExternalDBRefreshTypeNone No refresh is performed.
    '1 = MFExternalDBRefreshTypeQuick The quick refresh searches for new items and imports them to M-Files.
    '2 = MFExternalDBRefreshTypeFull The full refresh updates all the changes. This operation can take several minutes.

    oVault.ObjectTypeOperations.RefreshExternalObjectType 102, 1 'where "102" is the object ID that you want refreshed and "1" is quick refresh.


    Best Regards,
    Conny
Children
No Data