Tuesday, September 6, 2011

Archive or Copy Discussions in a Workflow

In the project I am currently working on, I have a requirement about archiving a discussion in a SharePoint Workflow. Actually, it is more complicated than that, as some information is also registered in a different list and the administrator/responsible for the discussions will also need to validate whether the discussion got a positive or negative feedback (which will influence the outcome of the workflow).

The main challenge here was the complex structure that discussions lists have. Each discussion is a folder and each reply an item inside that folder, from the type Message. All I wanted was to move the discussion from the original list to other one, archiving it. Using the workflow action to delete the item works, but not copying. So I created a new SharePoint Designer Action, the "Copy Discussion" action.


The set of articles "Working with SharePoint’s Discussion Lists Programmatically", from Itay Shakury, were very useful. You can find them here. It explains how stuff work and gives you code samples on how to access and create discussions and replies. It is for the 2010 version of SharePoint. Spot on. This was exactly what I was looking for. I then made my own version of it, according to my needs and got my custom workflow action going.

There is also another solution for archiving a discussion, using SPExport/SPImport. I found a topic on TechNet about the subject, in here. In my case, I prefer to do it programmatically, as it makes more sense in a workflow, than working with exports and imports.

No comments:

Post a Comment