Export of members from Document collections

Hi all :-)

I am solving the problem of automatic (= not manually) export of members of document collection. I found here very old topis Doucment collections export - Clients - Forums - M-Files Community which is closed and on Support page this one Export Document Collection members (m-files.com) but there are no solution for me...

So I try to ask the community in this new thread. 

What is problem:

Our users making and handling projects documents in M-Files vault but at the end of each phases of the project they need to export a set of documents for their customer. They are using Document collection which allows to "save" information about  "this was the version exported in that phase", which is nice and usefull, of course. For me the Document collection is like a View from some point of view but as opposed to View for Document collection is not possible to make export (neither right mouse function Export nor drag'n'drop to HD folder). 

What is the possibilities I am thinking about: 

  1. To make a View where will be all Members of Document collection. I can create Lookups of Members via API, I can create View via API, but I am not able to find any Conditions which will results the View with documents equals to members of collection. I think that this is not possible but maybe??
  2. To make an even handler on event "Before Download"  where for Document collections (and probably value YES in special attribute) I will walk through all members and one by one save to disk. This is only idea, I will start on this afterrnoon :-) But this seems good and usefull if no "hidden problem".
  3. To make a new menu item (UIX) for Export document collection. This should by more simple than point 2 but it needs special user interaction which is not good. 

Any other idea, please?

Thx, JJ

PS: Some other difficulty is that there could by Collection in Collection :-( 

  • Document collection members are indicated by a property on the collection called "Collection Members".  When the project gets to an appropriate phase you could find the appropriate document collections via the API (run a search), then find the members via this property, you should then be able to export the data you need.

    If this were done server-side (e.g. via VAF) then this would not need user interaction.

  • Hi. I have some news after sunday testing:

    • for point 1 I am almost sure, that there is no way to create View condition "all documents from collection"
    • for point 2 - first of all - this handler is not called for exportt Document collection, so this way is "cul-de-sac" :-( 

    Thank to Craig Hawker for suggestion. This could be point 4 :-) It is usefull but problem is that for customer export I have both documents (single/multi file) and document collection. So my idea was to export all together from "root" view. So "not user interaction" means for me "export all regardless of what it is - document or collection". It seems that some improvement inside MFiles function "Export" will be the best solution :-) 

    Thx, JJ

  • The vault contains two built-in properties: "collection members (documents)" and "collection members (document collections)".  These have IDs 46 and 47.

    For any given object (e.g. your "root" document collection) you can load the properties of the object and read these two properties.  Each is a multi-select-lookup so contains details of the documents (or collections), and optionally whether they are specific-version or latest-version entries.  You'd want any function to be recursive so that it drills down and gets documents within referenced collections within referenced collections...

    Aside from writing the files to disk in whatever format you need, and giving the user access to that export, I don't think this is a huge amount of code to write, if you have that as an option (which I assume you do as you mentioned writing a UIX as an option).

    As specific comments on your questions:

    • I don't believe you can create a view like this.
    • Document collections aren't downloaded (files are downloaded) so the event handler won't work.
    • A UIX is definitely an option to do this, although if you want to avoid user interaction then it's not the path I would use.  I would instead have some server-side code executed as and when objects meet whatever criteria should define that an export is needed.
  • Hi, Craig and thx for your suggestions and commenst :-) 
    We will searching the best way and in case of succes I will post here the solution :-) 

    JJ