I'm just bringing this back from the dead to contribute, because literally the only google result when you search for "ContentTableColumn.SetPropertyMap" is this thread, and i struggled a bit to figure out how to use it still.
For my use, I wanted to use the API and a VBA macro to add a new property column to a content center family, set its value to something specific, and map it to an inventor property.
Unfortunately, you have to update the family template to have the new property you want separately, and "replace family template" on it manually in the content center editor.
Here's the chunk that adds the property to the family table and creates the link to the inventor custom property:
Public Sub CCAddPropsToFam()
' Get the node in the content browser based on the names of the nodes in the hierarchy.
Dim CCNode As ContentTreeViewNode
Set CCNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("SAMPLE CATEGORY")
' Find a specific family. In this case it's using the display name, but any family
' characteristic could be searched for.
Dim family As ContentFamily
Dim checkFamily As ContentFamily
For Each checkFamily In CCNode.Families
If checkFamily.DisplayName = "SAMPLE FAMILY" Then
Set family = checkFamily
Exit For
End If
Next
Dim oContentTableColumns As ContentTableColumns
Set oContentTableColumns = family.TableColumns
'add one column
Dim oNewCol As ContentTableColumn
Set oNewCol = oContentTableColumns.Add("Sample", "Sample Property", kStringType, Expression:="Sample Value")
'set up property map (assumes that property exists in family template as a custom property called "Sample Property")
Call oNewCol.SetPropertyMap("Inventor User Defined Properties", "Sample Property")
'save change
Call family.Save
End Sub
And here's the other one that creates a custom version of the file, adds the property and saves it to a folder:
Public Sub CCCreateFamReplaceParts()
' Get the node in the content browser based on the names of the nodes in the hierarchy.
Dim CCNode As ContentTreeViewNode
Set CCNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("SAMPLE CATEGORY")
' Find a specific family. In this case it's using the display name, but any family
' characteristic could be searched for.
Dim family As ContentFamily
Dim checkFamily As ContentFamily
For Each checkFamily In CCNode.Families
If checkFamily.DisplayName = "SAMPLE FAMILY" Then
Set family = checkFamily
Exit For
End If
Next
Dim failureReason As MemberManagerErrorsEnum
Dim failureMessage As String
Dim memberfilepath As String
Dim memberFilename As String
memberfilepath = "C:\Users\Desktop\CCFamReplaceParts\" & family.DisplayName & ".ipt"
memberFilename = family.CreateMember(family.TableRows(1), failureReason, failureMessage, kRefreshOutOfDateParts, True, memberfilepath)
Dim partDoc As PartDocument
Set partDoc = ThisApplication.Documents.Open(memberFilename, False)
Dim customPropSet As PropertySet
Set customPropSet = partDoc.PropertySets("Inventor User Defined Properties")
Dim checkProp As Property
Dim partClassProp As Property
Set partClassProp = Nothing
For Each checkProp In customPropSet
If checkProp.name = "Sample Property" Then
Set partClassProp = checkProp
Exit For
End If
Next
' Set property if it doesnt exist, check value if it does.
If partClassProp Is Nothing Then
Set partClassProp = customPropSet.Add("Sample Value", "Sample Property")
Else
partClassProp.Value = "Sample Value"
End If
End Sub