New Class instance not picking up enforced workflow

I opened a ticket on this, but the community might be the better option.

I have an application that splits an MS Excel document into several different documents and uploads them to M-Files using the COM API. Everything works fine with creating the document. The fly in the ointment is that the document with the class does not pick up the enforced workflow.

The metadata for the class is:
Here is the results of the upload:
We can open the file fine, but there is no workflow associated with the document.
As a side note, we have a wrapper library built to encapsulate the COM API functionality.
What are we doing wrong?
  • You should be able to add the workflow and state as simple propertyvalues just like the other properties in you example. That way you won't have rely on the automatic workflow settings.

  • If I recall correctly the workflow setting in the class is only a directive for the M-Files client, it does not add or enforce the workflow on the server side. So if you are creating objects via the API, you need to set the workflow and state yourself to the built-in properties (ID 38 and 39).

  • This.

    The data is used by M-Files clients but is not enforced by the server.  Either ensure that you read the data (it can be read from the object class data via the API if you don't want to hard-code it) and provide the workflow and state properties when creating the object, or use a server-side event handler to react when the object is created and explicitly set the workflow if it's missing.

  • Thanks everyone! I appreciate this. We implemented setting this and everything works fantastic. I am going to need to rethink my Class structure.

    Is this documented in any of the developer documentation?