Working on an IBM Visual Info migration, we had a situation where we need to create links between documents using the SDK. This is a poorly documented area of both the SDK and the on line help, so I'm posting this in the hopes that is saves someone else some time. (Don't forget to "This was helpful" if it does, we love points!)
So you need to start with the Admin Console, Metadata, Document Links. There are two link types pre-defined, and then you can define your own:
This is important, because each of these items is referred by its ID, which is numeric starting at 1.
After some futzing around we found this code to work:
Dim EL As EntryLinkInfo = Nothing EL = EntryLink.Create(TargetDocInfo, NoteDocInfo, 3, "Link to document notes.", LF_Session)
Based on this SDK Reference:
Public Shared Function Create ( _ source As EntryInfo, _ target As EntryInfo, _ linkTypeId As Integer, _ description As String, _ session As Session _ ) As EntryLinkInfo
The problem was that there was no obvious information about the values of the linkTypeID. We found that 0 caused an error, 1 gave you this:
and 2 gave you this:
That's when the light bulb went off. We defined out own type, and called it using a value of 3:
So linkTypeID points to what are descriptive labels. But, without them you cannot create a link. Finally, EntryLinkInfo does not seem to have an Update or Dispose property, and the document is not locked while the link is created. You just create it or delete it.