Update-VaultItem
Updates an Item in Vault and manipulates its associations.
Syntax
Update-VaultItem -Number <String> [-NewNumber <String>] [-Title <String>] [-Description <String>] [-State <String>] [LifecycleDefinition <String>] [-Properties <Hashtable>] [-AddAttachments <String[]>] [-Attachments <String[]>] [-RemoveAttachments <String[]>] [<CommonParameters>]
Parameters
Type |
Name |
Description |
Optional |
---|---|---|---|
String |
Number |
Number of the Item, that should be updated |
no |
String |
NewNumber |
New Number that renames the Item by using the ‘Mapped’ Numbering Scheme. This scheme allows entering free item names. |
yes |
String |
Title |
The new title of the Item |
yes |
String |
Description |
The new description of the Item |
yes |
String |
State |
The name of the new lifecycle state for the Vault item |
yes |
String |
LifecycleDefinition |
The name of the new lifecycle definition that should be assigned to the Vault item |
yes |
Hashtable |
Properties |
The user-defined properties and their values which should be updated on the Item |
yes |
String[] |
AddAttachments |
Full paths to the Vault files that should be attached to the Item |
yes |
String[] |
Attachments |
Full paths to the Vault files that will replace the existing attachments of the Item |
yes |
String[] |
RemoveAttachments |
Full paths to the Vault files which should be detached from the Item |
yes |
Return type
Item ← on success
empty ← on failure. Exception/ErrorMessage can be accessed using $Error.
Remarks
In order to update properties of an Item the -Properties argument allows updating the values of used-defined properties which can be passed using their:
system names are prefided with ‘_’ and can be used with all Vault language environments (e.g.
@{'_ItemEffectivity' = ...}
)display names (e.g.
@{'Effectivity' = ...}
can be used with English Vault or@{'Gültigkeit' = ...}
can be used with german Vault environments).
When assigning a new LifeCycleDefinition and the current state of the item does not exist in the new LifeCycleDefinition, than the State must be updated as well.
Vault files can be attached to an Item using the -AddAttachments parameter, by passing an array of Vault file paths.
In the same way, all the existing attachment associations can be replaced using the -Attachments parameter and individual Vault files can be detached using -RemoveAttachments.
When some existing attachments are checked-out, then powerVault will check-in the previous file version of them.
Warning
You can only make changes to the items you could do with the Vault Client.
Examples
Rename an Item in Vault:
$item = Update-VaultItem -Number '100017' -NewNumber '111111'
Update the details of a Vault Item:
$item = Update-VaultItem -Number '100017' `
-Title "FINAL PART" `
-Description "COMBO STAND OFF" `
-Properties @{'Test'='Updated'}
Assign attachments to a Vault Item:
$parent = Get-VaultItem -Number 100001 $attachment = Get-VaultFile -File "$/Designs/ABC.ipt"
$parentUpdated = Update-VaultItem -Number $parent.Number -Attachments @($attachment.'Full Path')
Detach files from a Vault Item:
$item = Get-VaultItem -Number 100001 $attachment = Get-VaultFile -File "$/Designs/ABC.ipt"
$itemUpdated = Update-VaultItem -Number $item.Number -RemoveAttachments @($attachment.'Full Path')
Attach a new file to a Vault Item:
$item= Get-VaultItem -Number 100001 $attachment= Add-VaultFile -From "C:\Temp\ABC.ipt" -To "$/Designs/ABC.ipt"
$itemUpdated = Update-VaultItem -Number $item.Number -AddAttachments @($attachment.'Full Path')
Update the lifecycle state and definition of an item in Vault:
$item = Get-VaultItem -Number 100001
$itemUpdated = Update-VaultItem -Number $item.Number -LifecycleDefinition "Item Release Process" -State "Work in Progress"
Error handling, analyze why item could not be updated using $Error
$item = Get-VaultItem -Number 100001
$itemUpdated = Update-VaultItem -Number $item.Number -LifecycleDefinition "Not Exisiting LifecycleDefinition" -State "Released"
if(-not $itemUpdated){
$Error[0].Exception #Returns: "The LifecycleDefinition 'Not Existing LifecycleDefinition' does not exist."
}