< class="prominent-subhead ">

Code Fix: An error occurs when adding a folder to a SharePoint Document Library, and the workflow is set to start when an item is added

~~repeating-content.html~~
LEGACY/ARCHIVED CONTENT
This article has been archived, and/or refers to legacy products, components or features. The content in this article is offered "as is" and will no longer be updated. Archived content is provided for reference purposes only. This content does not infer that the product, component or feature is supported, or that the product, component or feature will continue to function as described herein.

Issue Description

When manually adding a folder to a SharePoint Document Library and a workflow is set to start when an item is added, an error occurs. The functionality to start a workflow when adding a folder is not available, which means the workflow should not start. However, when designing a workflow in K2 Studio or K2 Designer for Visual Studio and an Item Reference is used to set a property for example “Folio”, the event receiver attempts to start the workflow, which causes the error.

Error Message

The error states that: “Microsoft.SharePoint.Client.ServerException: Cannot invoke method or retrieve property from null object. Object returned by the following call stack is null. 'File'”. This error message is displayed in K2 Workspace > Workflow Server > Error Profiles > All or K2 Management > Workflow Server > Errors > All.

Resolution

  1. Ensure you have K2 Five installed.
  2. Get the K2 Five FP4 from Regional Support.
  3. Install the K2 Five FP4 to apply the fix.
  4. When adding a new folder manually the workflow will not start.