private void WriteExportStatus(SPWorkItem workItem, ExportStatus status) { lock (_writeLock) { if (workItem != null) { using (SPSite site = new SPSite(workItem.SiteId)) { using (SPWeb web = site.OpenWeb(workItem.WebId)) { try { SPList exportsList = web.Lists[workItem.ParentId]; SPListItem exportItem = exportsList.GetItemByUniqueId(workItem.ItemGuid); if (exportItem != null) { exportItem["ExportStatus"] = status.ToString(); exportItem.SystemUpdate(true); } } catch (Exception ex) { //failed to write ExportStatus } } } } } }