Hello,
Try referring to some of the stored procedures linked in EPDM database. One such stored procedure which will pull the list in similar passion to "Contains" list should be there. But you might need to change your code little bit by having DB connection strings and so on, which I am not sure you are looking for. Hope this information helps.
IEdmFile5::GetReferenceTree
Jim S.