Scenario: I have an Import Tool that imports files from network shares. In classic fashion we will have files like:
Agreement v1.pdf
Agreement v2.pdf
etc...
In some cases, these file would have been manually added to M-Files where the user would replicate version history in a single object as:
ID 1000 v1 - Agreement v1.pdf
ID 1000 v2 - Agreement v2.pdf
Since I am killing off the newtork shares, I am mass importing files and replacing the network share files with mflink files pointing to the files location in M-Files (either by importing the file as a v1 of a new object, or by finding that it already exists and makling the link point to the existing object found.
Agreement v1.pdf.mflink looks like mfiles://show/[vaultguid]/0-1000-1?object=[guid]
Agreement v2.pdf.mflink looks like mfiles://show/[vaultguid]/0-1000-2?object=[guid]
To do this I am making a trial object to import and using FindFileDuplicates to see if it already exists:
private static bool FindFileInMfiles(Vault theVault, ObjID testObjectID, FileVer testFile, out ObjVer foundObjVer) { foundObjVer = new ObjVer(); var results = theVault.ObjectFileOperations.FindFileDuplicates(testObjectID, testFile); if(results.Count == 0 ) { return false; } else { //We need the ObjVer for checking the properties so we need to get the real deal foundObjVer = theVault.ObjectOperations.????? //Need to get the ObjVer of the duplicate, but I can only seem to find the Latest GetLatestObjVer(results[1], false); return true; } }
As you can see in my code above, I can find the ObjID of something that has duplicate content, but it isn't clear to me if this is finding DuplicateFile Content in the Latest Version Only or finding duplicate content in any version of the returned object since all I get back is the 1000. Because I'd like to leave a version specific mflink file in the case of Agreement v1.pdf rather than have both v1 and v2 links simply point to the latest version of ID 1000.
Does FindFileDuplicates check all object versions or just the latest? And if it is al versions then how can I know which version had the Duplicate File?
Thanks,
Jason