Issue

When you upload a document to a SharePoint document library and information related to the document is also updated, including managed metadata, multiple minor versions of the document are created. 
Image

Cause

The issue is caused by a limitation in the SharePoint CSOM API which K2 uses to integrate with SharePoint. When there is metadata about the document, such as a managed metadata Lookup field, the CSOM API cannot upload the document and update the metadata fields in a single API call, so multiple versions of the document are created.

Workaround 

 You can work around this issue by publishing a major version of the document and deleting all minor versions. Follow the steps below to use this workaround:

  1. Enable the minor versions setting on the document library by opening the Library Settings > Versioning settings page and selecting the Create major and minor (draft) versions option.
  2. Appify the document library, creating SmartObjects, forms and a K2 workflow that starts when a document is edited. In the workflow, upload a new version of the document and update a metadata field. Notice that Version column (which you must add to the view) is updated multiple times.
    Image
  3. When you view the history of the document, multiple minor versions of the document are displayed on the Version History page.
    Image
  4. Add a SmartObject step to your workflow that executes the Publish Document method of the SmartObject that represents the document library. This publishes a major version of the document, in this case, 1.0.
    Image
  5. Add another SmartObject step to the workflow that executes the Delete Minor Versions method of the SmartObject that represents the document library. Only the major version of the document remains.
    Image

Configuring the SmartObject steps

Follow the steps below to configure the Publish Document and Delete Minor Versions SmartObject steps.

  1. Drag a SmartObject step on to canvas.
  2. In the SmartObject field, select the SmartObject created when you appified your document library. Select the Publish Document method in the Method field. In the Input Mappings field, add the Name from the reference created when you created your workflow.  You do not need any output mappings.
    Image
  3. Drag another SmartObject step on to the canvas.
  4. In the SmartObject field, select the SmartObject created when you appified your document library. Select the Delete Minor Versions method in the Method field. In the Input Mappings field, add the Name from the reference created with the workflow.  You do not need any output mappings.
    Image