Dim associations As ItemFileAssoc() = itemSvc.GetItemFileAssociationsByItemIds(ItemIds, ItemFileLnkTypOpt.Tertiary) 'primary
Dim associationsSec As ItemFileAssoc() = itemSvc.GetItemFileAssociationsByItemIds(ItemIds, ItemFileLnkTypOpt.Primary Or ItemFileLnkTypOpt.PrimarySub Or ItemFileLnkTypOpt.Secondary Or ItemFileLnkTypOpt.SecondarySub Or ItemFileLnkTypOpt.StandardComponent Or ItemFileLnkTypOpt.Tertiary) 'everything If Not associations.Length = 0 OrElse Not associationsSec.Length = 0 Then ' Only creates rows for items with seperate drawings Dim ItemNumber As String = ChildItem(0).ItemNum Dim SeperateDrawing As Boolean = False For a As Integer = 0 To UBound(associations) If Mid(ItemNumber, 1, 6) = Mid(associations(a).FileName, 1, 6) Then SeperateDrawing = True Exit For End If Next Dim SeperateDrawingSec As Boolean = False For a As Integer = 0 To UBound(associationsSec) If Mid(ItemNumber, 1, 6) & ".idw" = associationsSec(a).FileName Then SeperateDrawingSec = True Exit For End If Next If SeperateDrawing OrElse SeperateDrawingSec Then
Check the attached picture and you can see the Item 206640 has an idw-file.
But I can't get the file with this code. I can for many items, but some.. no 😞
With associationsSec I try every ItemFileLnkTypOpt there is, but still no files. I've logged some info:
4/24/2014 12:26:49 PM ChildItemNum 206233
4/24/2014 12:26:49 PM Cloaked = False
4/24/2014 12:26:49 PM associations = 1
4/24/2014 12:26:49 PM associationsSec = 2
4/24/2014 12:26:49 PM associations(a).FileName = 206233.idw
4/24/2014 12:26:49 PM associations(a).Cloaked = False
4/24/2014 12:26:49 PM associationsSec(a).FileName = 206233.ipt
4/24/2014 12:26:49 PM associationsSec(a).Cloaked = False
4/24/2014 12:26:49 PM associationsSec(a).FileName = 206233.idw
4/24/2014 12:26:49 PM associationsSec(a).Cloaked = False
4/24/2014 12:26:49 PM ChildItemNum 206640
4/24/2014 12:26:49 PM Cloaked = False
4/24/2014 12:26:49 PM associations = 0
4/24/2014 12:26:49 PM associationsSec = 1
4/24/2014 12:26:49 PM associationsSec(a).FileName = 206640.ipt
4/24/2014 12:26:49 PM associationsSec(a).Cloaked = False
Any ideas? 🙂
I solved this..
I got the wrong childitem id, i selected childitem(0), when I should've selected childitem(childitem.length -1).