Add-VaultRestriction

Adds a restriction to block the current operation.

Add-VaultRestriction -EntityName<String> -Message<String> [<CommonParameters>]

Type Name Description Optional
StringEntityNameThe title or affected object of the restriction.no
StringMessageThe message of the restriction.no

empty

The commandlet makes it possible to block the executing webservice call and upcoming Pre- or Post events.
Notes:

  • It is possible to add multiple restrictions with the same EntityName.
  • If a Restriction event has multiple subscribers then the event actions of all subscribers are executed even though the first subscriber already sets a restriction.
  • For Events (e.g CheckoutFile…) which are only for a single entity, the EntityName is not displayed in the restriction Dialog by the Vault Client.
The commandlet is only usable in the Restrictions events (e.g AddFile_Restrictions, UpdateFileStates_Restrictions…).

Adds a restriction for files which state is trying to be changed to released

Register-VaultEvent -EventName UpdateFileStates_Restrictions -Action { 
    param($files)
    foreach($file in $files)
    {
        if($file._NewState -eq "Released"){
            Add-VaultRestriction -EntityName $file.Name -Message "File state can't be set to released!"
        }
    }
}