Introduction

It is possible to update the metadata of the Document Set and the metadata of the file in the Document Set in a SharePoint Library. This Knowledge Base article describes how to use the K2 Designer for SharePoint and K2 Studio to update these values.

Implementation

Example 1

We are using a scenario that is based on a K2 Designer for SharePoint process which is created on a SharePoint Library. A Document Set is manually created. A document is then uploaded to the SharePoint library, moved to the Document Set and the metadata of the document is subsequently updated. Follow the steps below to implement the scenario.

  1. Create a SharePoint Document Library and name the library Legal.
  2. Navigate to Site Actions>Site Settings>Site Collection Administration and select Site collection features.
    Image
  3. Activate the Document Sets feature.
    Image
  4. Now navigate to the Document Library settings of the Legal Document Library, click on Advanced Settings, select Yes to allow for management of content types as shown below and click OK.
    Image
  5. Scroll down to the Content Types section and click on Add from existing site content types.
    Image
  6. Select Document Set and click Add, then click OK.
    Image
  7. Go to the Legal Document Library and select the Documents tab at the top.
  8. Click the arrow next to New Document and select Document Set.
    Image
  9. Use Legal Documents as the name for the new Document Set. Click OK. The Document Set is created.
    Image
  10. Go to the Legal Document Library and create the following columns:
    • Type of document (type text)
    • Status (type text)
  11. Navigate to Site Actions>K2 Site Settings>SmartObject Management and select K2 SmartObject Site Lists and Libraries. Tick the box next to the Legal Document Library and click Create.
    Image
  12. Navigate to the Legal Document Library, open the K2 Designer for SharePoint and create a process that will move a document that is uploaded to the Legal Document Library to the Legal Documents Document Set. Use the Move Document event for this purpose. Select the Legal Documents Document Set in the Move Document wizard as shown below.
    Image
  13. Add another outcome to the activity and call it Update status.
  14. Drag the Update Document event onto the Outcome.
  15. Drag the Document Name from the Document Context, type Risk in the Type of document field and Archived in the Status field. Finish the wizard.
    Image
  16. Add another outcome to the process and drag a Placeholder event onto the outcome.
  17. The process should resemble the following:
    Image
  18. Save and deploy the process.
  19. Navigate to the Legal Document Library and upload a document.
  20. Type New in the Status field and click Save.
    Image
  21. Start the process by clicking on the arrow next to the document and select Workflows. Click on the process you created and click Start.
  22. Note the status of the item in the Legal Document Library
    Image
  23. Wait for the process to finish and go to the Legal Documents Document Set. Note the Risk and Archived entries.
    Image

Example 2

The same scenario as above is used for the second example. In this example the metadata of the Document Set is updated using the SmartObject Event in K2 Studio.

      1. Create a K2 Studio process and drag the SmartObject Event onto the canvas.
      2. On the Event Name and SmartObject Method screen, click on the ellipsis next to SmartObject Method.
      3. Add the Update method of the Document Set as shown below:
        Image
      4. Complete the fields below:
        • Content Type: Document Set
        • Name: [Document Set Name]
        • Specify values for any custom fields
        Image
      5. Finish the wizard.
      6. Save and deploy the process.
      7. Start an instance of the process in K2 Workspace.
      8. Note the change of the status column of the Document Set.
        Image

In order to complete this example in the K2 Designer for SharePoint, SmartObject Access needs to be configured on the Document Set in SharePoint.

    1. Navigate to Site Actions>K2 Site Settings>K2 Designer for SharePoint Management>Configure SmartObject Access.
      Image
    2. Click Add new item.
    3. Select the Document Set and click Next.
      Image
    4. Click Finish.
    5. Go to the Legal Document Library and start a new K2 Designer for SharePoint process.
    6. The SmartObject tab is added at the top and the Update Document Set methodis now available for use.
      Image
    7. Apply the same concept as in Example 2 above.