Hi @ersin_karacoban. Maybe this example code will give you some ideas. It is just for checking the top level (or direct) document and file references of a single document, as it is. But a routine similar to this could be put into a separate custom Function, and called from the main routine, as it iterates through all levels of an assembly. I am not sure what you were expecting as a result (or feedback) of running a rule like this, bit this example uses two List(Of String) type objects to keep track of only the ones that are 'missing', then shows you the list at the end of both loops.
Sub Main
Dim oDoc As Document = ThisDoc.Document
CheckDocuments :
Dim oList1 As New List(Of String)
Dim oRDDs As DocumentDescriptorsEnumerator = oDoc.ReferencedDocumentDescriptors
If oRDDs.Count > 0 Then
For Each oRDD As DocumentDescriptor In oRDDs
'If oRDD.ReferenceSuppressed Then
'If oRDD.ReferenceDisabled Then
'If oRDD.ReferenceInternalNameDifferent Then
If oRDD.ReferenceMissing Then
oList1.Add(oRDD.FullDocumentName)
End If
Next 'oRefDoc
End If
If oList1.Count > 0 Then
a = InputListBox("", oList1, "", "DocumentDescriptors Missing References")
End If
CheckFiles :
Dim oList2 As New List(Of String)
If oDoc.FileSaveCounter > 0 Then
Dim oRFDs As FileDescriptorsEnumerator = oDoc.File.ReferencedFileDescriptors
If oRFDs.Count > 0 Then
For Each oRFD As FileDescriptor In oRFDs
'If oRFD.ReferenceLocationDifferent Then
'If oRFD.ReferenceDisabled Then
'If oRFD.ReferenceInternalNameDifferent Then
If oRFD.ReferenceMissing Then
oList2.Add(oRFD.FullFileName)
End If
Next 'oRFD
End If
End If
If oList2.Count > 0 Then
a = InputListBox("", oList2, "", "FileDescriptors Missing References")
End If
End Sub
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield

(Not an Autodesk Employee)