Adding columns to all Families in a content center library

Adding columns to all Families in a content center library

mslosar
Advisor Advisor
312 Views
1 Reply
Message 1 of 2

Adding columns to all Families in a content center library

mslosar
Advisor
Advisor

We are moving to new internal systems and i'm going to have to add several columns to all of our content center libraries. I'm trying to do this via ilogic so i don't have to open a few hundred libraries to do this.  I can loop through the families, but it keeps throwing errors adding a column.  The error is that clear as mud 'the parameter is incorrect'.  It's at the TableColumns.Add line...what am i missing here?

 

Public Sub Main()

        Dim oContentCenter As ContentCenter
        oContentCenter = ThisApplication.ContentCenter

        Dim a As ContentTreeViewNode
        a = oContentCenter.TreeViewTopNode

        Call LoopGetFromTreeView(a)
    End Sub

Private Sub LoopGetFromTreeView(oContentTreeViewNode As ContentTreeViewNode)

        Dim oContentTreeViewNodeLoop As ContentTreeViewNode     
        Dim strPath As String
        strPath = oContentTreeViewNode.FullTreeViewPath
        Dim strFam As String
        strFam = oContentTreeViewNode.DisplayName
        Dim strExport As String
        strExport = oContentTreeViewNode.DisplayName

        Dim oContentFamily As ContentFamily
        For Each oContentFamily In oContentTreeViewNode.Families
			'do something here
			MessageBox.Show(oContentFamily.DisplayName)			
			
			MessageBox.Show("2")
			
    		oContentFamily.TableColumns.Add("Item Group", "Item Group [Custom]", ValueTypeEnum.kStringType)
			
			MessageBox.Show("3")
   			
    		'modify cell
    		Dim oRow As ContentTableRow
    		For Each oRow In oContentFamily.TableRows
                		
        		oRow.Item("Item Group").Value = "Purchase Lot -100030"
        		
    		Next
    
    		'save change
    		Call oContentFamily.Save

        Next

        For Each oContentTreeViewNodeLoop In oContentTreeViewNode.ChildNodes

          Call LoopGetFromTreeView(oContentTreeViewNodeLoop)

        Next
    End Sub
0 Likes
Accepted solutions (1)
313 Views
1 Reply
Reply (1)
Message 2 of 2

mslosar
Advisor
Advisor
Accepted solution

So, It would appear the internal name can't have a space. I changed "Item Group" to "ItemGroup" and it works.

0 Likes