1

I am attempting to create a task in my state machine workflow on SP2010.

theTaskID = Guid.NewGuid();
theTask.AssignedTo = "domain\\dave.lozzi";
theTask.Title = "Application";
theTask.Description = "The application requires your review";
theTask.TaskType = 0;

Pretty simple right? When I run the workflow the task gets created. If I change the AssignedTo to anyone else (I tried 3 other accounts), the task gets created but no one is assigned. Each user is in the Members group and has Contribute permission to the site.

I even logged in as one of the other users, updated the code to match my new user name, and that still didn't work.

I can update the task manually and assign it there to the account I need to, and I can do this under my account and another account. I don't think it's a permissions issue...

Any ideas?

1

RESOLVED

I used the EnsureUser method which fixed it.

        SPUser usr = workflowProperties.Web.EnsureUser("domain\\sptest01");
        theTask.AssignedTo = usr.LoginName;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.