I'm adding blocks and notes automatically with my add-in, both directly and with drag and drop. Both of these methods fail when the block or note is saved in a future version.
Is there a way to detect the version for these kinds of files with the API? I know how to do it for models, but those methods fail for annotations.
SolidworksApi/macros
Witch language are you using ? I don't think you can get the version of a block file, but you can manage exception.
Setup a try catch (here an exemple in vb.net):
My products are all in C#. Your solution is exactly what I currently do. The Add method returns null when adding the note or block fails, so I check for that. But a future version file is not the only reason it might fail, so I was hoping I could check the version directly like I do with models.
SolidWorks sends you three messages when you add a block manually and it fails, one of them is a future version warning. So it can be done, probably just with the API.