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
KB002148
PRODUCT
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
- Ensure you have K2 4.7 installed.
- Download and install the K2 4.7 November 2017 Cumulative Update from K2 Partner and Customer Portal.
- Get the K2 4.7 November 2017 Cumulative Update FP6 from Regional Support.
- Install the K2 4.7 November 2017 Cumulative Update FP6 to apply the fix.
- When adding a new folder manually the workflow will not start.