title: How to alter sharepoint workflow task status?
body: <p>I am novice in sharepoint programming. I have a following code:</p>
  
  <pre><code>SPWorkflowTask  task = some_getter();
  task["Status"] = "Canceled";    
  task.Update();
  </code></pre>
  
  <p>and I am getting SPException:</p>
  
  <pre><code>Microsoft.SharePoint.SPException: "This task is currently locked by a running workflow and cannot be edited."
  at Microsoft.SharePoint.SPListItem.PrepareItemForUpdate(Guid newGuidOnAdd, Boolean bMigration, Boolean&amp; bAdd, Boolean&amp; bPublish, Object&amp; objAttachmentNames, Object&amp; objAttachmentContents, Int32&amp; parentFolderId)
  at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents)
  at Microsoft.SharePoint.SPListItem.Update()
  at mycode
  </code></pre>
  
  <p>I believe I am doing something fundamentally wrong. Can anybody help me?</p>