The M-Files Community will be updated on Tuesday, April 2, 2024 at 10:00 AM EST / 2:00 PM GMT and the update is expected to last for several hours. The site will be unavailable during this time.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Multi file Document with single object

Hello 

Is there an easy way to identify all multifile with only one document in it ?

  • If by easy you mean out-of-the-box, then now.  But if you consider VAF or a console app easy, then yeah.

    I used the standard search to get ObjectSerachResults for a subset of object.  Then I used 

    results.GetAsObjectVersions().GetAsObjVers()

    to get the ObjVer class for each object returned by the search.  Finally I iterated through each ObjVers and applied

    vault.ObjectFileOperations.GetFiles(objVer).Count

    To get the number of documents in each object.

    Alternatively, you may want to insert 

    vault.ObjectOperations.GetObjectVersionAndPropertiesOfMultipleObjects(results.GetAsObjectVersions().GetAsObjVers(), true, false, false, true)

    In between the first and 2nd snippet above because that returns ObjectVersionsAndProperties, which can be iterated to ObjectVersionAndProperties which has a property called VersionData which has a property called SingleFile.  That way you can filter out anything that is a single file document (i.e. file count is 1).  But if your search only returns multi-file documents, than this is excess.