Created
November 25, 2020 13:28
-
-
Save slydlake/9a1bb58bc77aec3889ed3db1d5b8a614 to your computer and use it in GitHub Desktop.
[VDS Open URL] #VDS #powershell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-PropertyValueByItemNumber($number, $propertyName) { | |
#get item | |
$item = $vault.ItemService.GetLatestItemByItemNumber($number) | |
$itemRevision = New-Object Autodesk.DataManagement.Client.Framework.Vault.Currency.Entities.ItemRevision($vaultConnection, $item) | |
#get all props | |
$props = $vaultConnection.PropertyManager.GetPropertyDefinitions("ITEM", $null, [Autodesk.DataManagement.Client.Framework.Vault.Currency.Properties.PropertyDefinitionFilter]::IncludeAll) | |
#propdef of propertyname | |
$propertyDefinition = $props | Where-Object{$_.Value.DisplayName -eq $propertyName} | |
#get value | |
$propertyValue = $vaultConnection.PropertyManager.GetPropertyValue($itemRevision, $propertyDefinition.Value, $null) | |
return $propertyValue | |
} | |
#get item of context | |
$selectedItem = $vaultContext.CurrentSelectionSet[0] | |
$itemId = $selectedItem.Id | |
if ($selectedItem.TypeId.EntityClassId -eq "FILE") { | |
$file = ($vault.DocumentService.FindLatestFilesByMasterIds(@($itemId)))[0] | |
$item = $vaultConnection.WebServiceManager.ItemService.GetItemsByFileId($file.Id) | |
#$dsDiag.inspect('$item.TypeId.EntityClassId') | |
} | |
elseif ($selectedItem.TypeId.EntityClassId -eq "ITEM") { | |
$item = $vaultConnection.WebServiceManager.ItemService.GetItemsByIds($itemId) | |
} | |
#get property value of URL | |
$dsParam= Get-PropertyValueByItemNumber $item.ItemNum "URL-Link" | |
#start function | |
openURL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment