You can use GetContentObject() of ContentCenter to get data about an occurrence that was placed from content center. There are two samples that use the ContentCenter object in the API help file, however there is not an example of using GetContentObject(). If you are trying to use this method it will help to know how to create the string so it will return what you need.
In a recent case my colleague Xiaodong Liang explained that if the MemberId is included in the string parameter, GetContentObject() returns the ContentTableRow and if the MemberId is not provided, the method returns the ContentFamily. To get the MemberId you access a PropertySet of the PartDocument. (Use the Definition of the occurrence).
PartDocument->PropertySets->Content Library Component Properties>item[MemberId].Value.
VBA Example. (Please keep in mind that we only recommend using VBA for prototyping and learning the API but do not recommend using VBA in production).
Sub GetContentObject_Test()
Dim oOcc As ComponentOccurrence
Set oOcc = ThisApplication.CommandManager.Pick _
(kAssemblyOccurrenceFilter, "Pick occurrence")
If oOcc.DefinitionDocumentType <> _
kPartDocumentObject Then
MsgBox _
"The occurrence is not a CC part."
Exit Sub
End If
Dim oOccDef As PartComponentDefinition
Set oOccDef = oOcc.Definition
If Not oOccDef.IsContentMember Then
MsgBox _
"The occurrence is not a CC part."
Exit Sub
End If
' Set a reference to the ContentCenter object.
Dim oContentCenter As ContentCenter
Set oContentCenter = _
ThisApplication.ContentCenter
' Reference "CC Library Component
' Properties' propertyset
Dim propSet As PropertySet
Set propSet = _
oOccDef.Document.PropertySets.Item _
("{B9600981-DEE8-4547-8D7C-E525B3A1727A}")
' Get FamilyId property
Dim familyId As Property
Set familyId = propSet.Item("FamilyId")
' Get MemberId property
Dim strMemberId As String
strMemberId = propSet("MemberId").Value
Dim msgBoxResult As VbMsgBoxResult
msgBoxResult = MsgBox _
("Get Family ?", vbYesNo, "Yes=Family No=Row")
If msgBoxResult = vbYes Then
' Get family, (Not including memberId)
Dim oContentFamily As ContentFamily
Set oContentFamily = _
oContentCenter.GetContentObject _
("v3#" & familyId.Value & "#")
MsgBox "family display name: " _
& oContentFamily.DisplayName & vbCr & _
"family LibraryName name: " & _
oContentFamily.LibraryName
Else
' Get Table Row, (Including memberId)
Dim oContentTableRow As ContentTableRow
Set oContentTableRow = _
oContentCenter.GetContentObject _
("v3#" & familyId.Value & "#" & strMemberId)
Dim str As String
str = "Data from cells in Table Row" & vbCr
' Debug.Print oContentTableRow.count
For i = 1 To oContentTableRow.count
' Debug.Print i
' Debug.Print oContentTableRow.GetCellValue(i)
str = str & oContentTableRow.GetCellValue(i)
Next
MsgBox str
End If
End Sub
Wayne Brill