Add-VaultRestriction
Adds a restriction to block the current operation.
Syntax
Add-VaultRestriction -EntityName <String> -Message<String> [<CommonParameters>]
Parameters
Type  | 
Name  | 
Description  | 
Optional  | 
|---|---|---|---|
String  | 
EntityName  | 
The title or affected object of the restriction.  | 
no  | 
String  | 
Message  | 
The message of the restriction.  | 
no  | 
Return type
empty
Remarks
The Cmdlet makes it possible to block the executing webservice call and upcoming Pre- or Post events.
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.
Note
The Cmdlet is only usable in the Restrictions events (e.g AddFile_Restrictions, UpdateFileStates_Restrictions…).
Examples
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!"
	        }
	}
}