I think the problem is that you are using the 'using' statement in your creation and get methods which close the connection to the system COM server at the end of the 'using' clause. When you call the edit method, you have a valid task object, but the TaskService object is not valid. Opening and closing the TaskService object, is not a good idea in this sample code. I would recommend getting an instance of the TaskService once and holding it until you're done working with the task. In other words, put TaskService into a field variable and don't use the 'using' statements.
↧