Copy Elements from Link with question if I want to replace object

Hi, I wish to copy objects from a linked file. The new object uses an updated family. My wish is that Revit asks me if I want to replace it, but currently, I don´t get it to work. Revit copies the object and creates a new family with a number extension in the name. The code I use is the following:

TransactionManager.Instance.EnsureInTransaction(doc)
copy = ElementTransformUtils.CopyElements(linkDoc, eId, doc, tf1, None)
TransactionManager.Instance.TransactionTaskDone()

I currently try to create CopyPasteOptions to use it, but it does not work as expected. It seems to need a handler and I don´t know how to setup this :frowning:

options = CopyPasteOptions()
options.SetDuplicateTypeNamesHandler()

# I struggle with this area
#options.SetDuplicateTypeNamesHandler(new DuplicateTypeAction.UseDestinationTypes) 
#DuplicateTypeAction.UseDestinationTypes
#new IDuplicateTypeNamesHandler

TransactionManager.Instance.EnsureInTransaction(doc)
copy = ElementTransformUtils.CopyElements(linkDoc, eId, doc, tf1, options)
TransactionManager.Instance.TransactionTaskDone()

Thanks for your help :slight_smile: