I'm trying to create a task, in a VS 2010 workflow, and assign it to one of our domain users. This guy's not a site collection user, but I'm assuming that he'll be added to Sharepoint automatically. He's also located in another company branch, somewhere in South Africa. The code I'm using is something like
private void CreateTask_MethodInvoking(object sender, EventArgs e)
{
TaskProps = new SPWorkflowTaskProperties();
TaskId = Guid.NewGuid();
TaskProps.AssignedTo = @"MYDOMAIN\username";
TaskProps.Title = "Sample task";
}
Once I deploy and run the workflow, the task gets created just fine, but the "Assigned To" field is blank. The event log shows that "User does not exist or is not unique."
Furthermore, if I create a task by hand, and put MYDOMAIN\username in the "Assigned To" field, it gets created with no problems, and the user gets imported to the site collection. After that, the workflow runs all right. Manually adding each of our 200+ domain users to the site collection is not an option, though. Suggestions?