Andreas,
You don't say whether or not the workflow you have is a custom written or SPDesigner workflow.
I've hit a lot of problems with updating documents from the workflow due to whether or not the document has a check-out on it.
There are four types of check-out:-
- None - Quite obvious really..
- Short Term - This is when the user has opened the attachment in it's application and made a change to it, saving it back without closing the application. (Just opening the document doesn't lock it out (I've only tried this with Excel and Word tho!)
- Long Term - This is where someone has used the Check-Out option.
- Long Term Offline - I've not found what causes this, I'm assuming that it's when someone checks out the document and they're presence information shows them as offline?
If you're workflow is doing any form of editing of the List item, then you will have to check the lock status and vary your method of updating the object.
The method i use is similar to the following. (Note: This method ignores any changes the user is currently making as the workflow takes precedence in my environment. In your's, you might want to queue the changes somewhere and come back to them when the lock has gone.)
try
{
SPListItem item = workflowProperties.Item;
item["Provisional Charge Date"] = DateTime.Now;
item["SO Status"] = "Finalisation workflow underway";
if (item.File.CheckOutStatus == SPFile.SPCheckOutStatus.None)
{
item.Update();
}
else
{
//Something has the Excel file locked, so we'll burn through the lock to force the update.
item.SystemUpdate();
}
item = null;
}
Hope this helps.
Paul.
www.myfatblog.co.ukMCTS: WSS 3.0
MCTS: MOSS 2007