This is very helpful; thank you.
I have encapsulated it and saved it to my general code library. In case anyone else finds it useful, here’s how it looks:
Option Explicit On
Imports Autodesk.DataManagement.Client.Framework.Forms
Imports Autodesk.DataManagement.Client.Framework.Forms.Currency
AddReference "Autodesk.DataManagement.Client.Framework.Forms.dll"
Sub Main
VaultPrompts_Disable
' Undisturbed area
VaultPrompts_Enable
End Sub
Sub VaultPrompts_Disable
' Adjust to your needs
SetVaultPrompt(VaultPromptId.CheckOutOnFileEdit, PromptInstruction.PromptNever, PromptAnswer.No)
SetVaultPrompt(VaultPromptId.OpenFromVaultNotCheckedOut, PromptInstruction.PromptNever, PromptAnswer.No)
SetVaultPrompt(VaultPromptId.IDS_ONRESOLVEFROMVAULT_REV, PromptInstruction.PromptNever, PromptAnswer.Yes)
SetVaultPrompt(VaultPromptId.IDS_CHECKOUT_LOCKED_WARN, PromptInstruction.PromptNever, PromptAnswer.Yes)
End Sub
Sub VaultPrompts_Enable
' Edit code, so it resets what wass disabled in Sub VaultPrompts_Disable
SetVaultPrompt(VaultPromptId.CheckOutOnFileEdit, PromptInstruction.PromptAlways, PromptAnswer.Yes)
SetVaultPrompt(VaultPromptId.OpenFromVaultNotCheckedOut, PromptInstruction.PromptAlways, PromptAnswer.Yes)
SetVaultPrompt(VaultPromptId.IDS_ONRESOLVEFROMVAULT_REV, PromptInstruction.PromptAlways, PromptAnswer.Yes)
SetVaultPrompt(VaultPromptId.IDS_CHECKOUT_LOCKED_WARN, PromptInstruction.PromptAlways, PromptAnswer.No)
End Sub
Enum VaultPromptId
CheckOutProperties ' Some properties may be out of date. Do you want to update properties?
CheckOutOnFileEdit ' File '{0}' is not checked out. Do you want to check it out?
OpenFromVaultNotCheckedOut ' File(s) are not checked out. Do you want to check them out?
DownloadConfirmReplaceCheckedOut ' File '{0}' is checked out to you. Are you sure you want to overwrite it with data from vault?
IDS_ONRESOLVEFROMVAULT_REV ' File '{0}' is missing from your workspace. Would you like to download it from the vault?
DownloadConfirmReplaceLocalEdits ' Local file {0} has been modified.
CheckInOnClose ' File '{0}' is checked out to you. Do you want to check it in?
CheckInSave ' '{0}' must be saved before it can be checked in. Do you want to save and continue?
IDS_CHECKOUT_LOCKED_WARN ' '{0}' is currently locked. Do you want to continue editing anyway? Your changes will not get saved to the vault.
IDS_CHECKOUT_OTHER_WARN ' '{0}' is checked out to another user. Do you want to continue editing anyway? Your changes will not get saved to the vault.
IDS_READONLY_WARN ' '{0}' is not vaulted, and file is read only. Allow component editing?
IDS_CHECKOUT_LOCATION_WARN ' '{0}' is checked out to you but at '{1}' Do you want to continue and edit anyway?
SyncWithRemoteSite ' The file you are attempting to access has not yet been copied to your local server. The file is inaccessible until it has been copied. Wo
End Enum
Sub SetVaultPrompt(Id As VaultPromptId, Instruction As PromptInstruction, Answer As PromptAnswer)
Dim promptDefinitions = Library.PromptService.GetPromptDefinitions()
Dim fileEditPromptDefinition = promptDefinitions.Where(Function(p) p.PromptId = Id.ToString).First()
Dim fileEditPromptConfig = Library.PromptService.GetConfiguration(fileEditPromptDefinition)
fileEditPromptConfig.UserAnswer = Answer
fileEditPromptConfig.PromptInstruction = Instruction
Library.PromptService.SetConfiguration(fileEditPromptDefinition, fileEditPromptConfig)
End Sub