VBA: Method 'GetPropertyMap' of object 'ContentTableColumn' failed

VBA: Method 'GetPropertyMap' of object 'ContentTableColumn' failed

j.pavlicek
Collaborator Collaborator
785 Views
2 Replies
Message 1 of 3

VBA: Method 'GetPropertyMap' of object 'ContentTableColumn' failed

j.pavlicek
Collaborator
Collaborator

This happened when tried to read PropertyMap values from a Content Center Family using VBA macro. (Full story in topic: iLogic: How to retireve values from ContentTableColumn.GetPropertyMap Method?)

 

I create make VBA macro for reading properties from a FamilyTableColumn. And test it on a little modified copy of ISO 7098 washer.

 

VBA code snippet

 

For Each oColumn In oFamilyTableColumns
	With oColumn
		Debug.Print "DataType = " & .DataType
		Debug.Print "DisplayHeading = " & .DisplayHeading
		Debug.Print "Expression = " & .Expression
		Debug.Print "HasPropertyMap = " & .HasPropertyMap
		Debug.Print "InternalName = " & .InternalName
		Debug.Print "KeyColumnOrder = " & .KeyColumnOrder
		Debug.Print "Type = " & .Type
		Debug.Print "Units = " & .Units
		
		Dim s1 As String
		Dim s2 As String
		
		If .HasPropertyMap Then
		   Call oColumn.GetPropertyMap(s1, s2)
		End If
		
		Debug.Print "PropertySetId = " & s1
		Debug.Print "PropertyIdentifier = " & s2
		Debug.Print "---------------------------"
	End With
Next oColumn

 

 

Output:

 

Blocks before deleted for better readability (all of them have HasPropertyMap = False )
---------------------------
DataType = 14595
DisplayHeading = Designation
Expression = {NND}
HasPropertyMap = False
InternalName = SIZE
KeyColumnOrder = 0
Type = 50422528
Units = 
PropertySetId = 
PropertyIdentifier = 
---------------------------
DataType = 14595
DisplayHeading = Size Designation
Expression = {NND}
HasPropertyMap = True
InternalName = DESIGNATION
KeyColumnOrder = 0
Type = 50422528
Units = 
PropertySetId = {32853F0F-3444-11d1-9E93-0060B03C1CA6}
PropertyIdentifier = 52
---------------------------
DataType = 14595
DisplayHeading = File Name
Expression = Copy of "ISO 7089" & "-" & {NND}&_&{MATERIAL}
HasPropertyMap = True
InternalName = FILENAME
KeyColumnOrder = 0
Type = 50422528
Units = 

 

When it hits column "File Name", GetPropertyMap Method fails with following error:

 vba_error.png

This error is usually thrown during attempt to modify locked/read-only object.

But this Family is not read-only and - as you can see in log block above the last (DESIGNATION) - PropertyMap here was got successfully.

 

So it means, problem is column specific. This is screenshot of Column Properties

inv-column-props.png

 

No Map set here, but HasPropertyMap = True (!)

 

It's possible that some PropertyMap was set here before and then "removed" (in GUI - this column was never modified via VBA, iLogic etc by me). Needs future investigation, but I don't have time for that, now.

 



Inventor 2022, Windows 10 Pro
Sorry for bad English.
0 Likes
Accepted solutions (1)
786 Views
2 Replies
Replies (2)
Message 2 of 3

j.pavlicek
Collaborator
Collaborator
Accepted solution

Workaround:

 

Use Error handling to avoid macro break by GetPropertyMap Method fail (add to code above).

 

On Error Resume Next
If .HasPropertyMap Then
   Call oColumn.GetPropertyMap(s1, s2)
End If
On Error GoTo 0

  

Optionally (recommended):

Use ContentTableColumn.ClearPropertyMap Method when an error is throw, to set HasPropertyMap to False.



Inventor 2022, Windows 10 Pro
Sorry for bad English.
0 Likes
Message 3 of 3

FRFR1426
Collaborator
Collaborator

There is a problem with the FILENAME column. You can skip it with:

If column.HasPropertyMap And column.InternalName <> "FILENAME" Then

 

Maxence DELANNOY
Manager
Add-ins development for Autodesk software products
http://wiip.fr
0 Likes