Hello,
To change the folder properties using powershell you need the folder id and the id of the property you want to change.
Then you need to define a PropInstParam Object and add the parameter .PropDefId and .Val.
After that you need to define a PropInstParamArray and add your PropInstParam Object.
Finally update the folder properties using folder id and the Array as parameters. Please see the attached code sample.
Note that this only works with user defined properties.
Thanks for the prompt reply.
I am trying to loop through all folders and assign the 'lifecycle definition' property to all folders based on folder 'Category name' property.
'LifeCycle Definition' is a System property. is it possible? Please let me know. Thanks.
Hello,
Yes it is possible to change LifeCycleDefinition with the Vault API, with
$vault.DocumentServiceExtensions.UpdateFolderLifeCycleDefinitions() The parameters for this are the folder ids, the new LifecycleDefinition, the New State
you can get the categories with Cat.CatName and the folders with $vault.DocumentService.GetFoldersByParentId(parentfolderId, bool recurse)
Thanks Manuel.
have you got any sample codes that you can provide using Vault API. Cheers.
Hello,
here is the sample code:
#gets all children without the parent folder $folders = $vault.DocumentService.GetFoldersByParentId(<parentFolderId>, $true) #loops through all folders and changes lifecycle definition and state foreach ($folder in $folders) { if ($folder.Cat.CatName -eq "<CategoryName>") { $vault.DocumentServiceExtensions.UpdateFolderLifeCycleDefinitions($folder.Id, <NewLifecycleDefId>, <NewStateId>, <commentcanbe$null>) } }
Kind regards,
Manuel Cassan
Thanks Manuel.
I got lifecycles configured in Vault already, how can I filter out the lifecycle I want to add it as parameter to <NewLifecycleDefId>
Thanks in Advance. appreciate your time.
If i understand correctly you want to have a list of the Ids of the lifecycle definitions? in that case this is the right code:
$vault.LifeCycleService.GetAllLifeCycleDefinitions()
Thanks Manuel.
If this answered all your questions i will mark this topic as solved.
Kind regards,
Manuel Cassan
Sure Thanks Manuel.
Venkat
Hi
How to Get Vault folders/Sub folders and update the properties using powershell.
Thanks.