1. Background
Copy Version History with SPListItemVersion to a new SPListItem Part 1 - http://k2distillery.blogspot.com/2007/10/copy-version-history-with_5.html
In a prior entry we were researching how to move the history from a SPListItem to another SPListItem that will be archived to another location. While doing research on this, we decided to check K2.net BlackPearl to see if it supported copying the version information. Using Reflector we were able to see that K2.net BlackPearl was not supporting the coping of version history when an SPListItem is copied from one list to another.
2. Resolution
The resolution is simple and still the same was as it would be done in K2.net 2003. Basically we need to go modify the code; the only difference is that we are now writing code in Windows Workflow Foundation (WF) instead of in an standard event handler.
Now go to the Event, right click on it and select to view the Event Item.
This will drive you to a screen where you will see the under laying WF code which BlackPearl is built on. Just seeing this is makes me giddy; even the underlying code is presented in a graphical format allowing developer to zero on the exact thing they need to modify. Writing code in this manner forces developers to write more modular code which is easier to understand and maintain.
There are two ways you can make this modification.
2.1 Option 1
One option would be to double click on CopyListItem code event handler and you will be taken to a code screen that you can start modifying.
2.2 Option 2
The second option would be to add an if statement and then add a new code event to the workflow. This is the best solution as it first segregates the custom code from the K2.net code. Second all of the K2 SharePoint events use their custom web services which we will not use. Instead we would insert code which was discussed in the part of this article series.
No comments:
Post a Comment