-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
I am attempting to set custom properties when building shapes via the "directed graph from code" example. Note: the shapes don't exist yet so I can't use set-visiocustomproperty function. I have tried the code below plus multiple variations:
This code will create the "DisplayName1234" custom property but the value is always 0.
$g1 = $d.AddShape("g1", "webserver", "Servers.vss", "Server")
$cpDic = New-Object VisioAutomation.Shapes.CustomPropertyDictionary
$cpCellsName = New-Object VisioAutomation.Shapes.CustomPropertyCells
$cpCellsName.Value = "testVal"
$cpDic.Add("DisplayName1234",$cpCellsName)
$g1.CustomProperties = $cpDic
I've also tried:
$cpCellsName = New-Object VisioAutomation.Shapes.CustomPropertyCells
$cpCellsName.Value = "testVal"
[VisioAutomation.Shapes.CustomPropertyHelper]::Set($g1.VisioShape,"displayname",$cpCellsName)
but it results in:
[VisioAutomation.Shapes.CustomPropertyHelper]::Set($g1.VisioShape,"DisplayName",$cpCellsName)
Exception calling "Set" with "3" argument(s): "
#NAME?"
At line:1 char:1
+ [VisioAutomation.Shapes.CustomPropertyHelper]::Set($g1.VisioShape,"Di ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : COMException
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels