Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

RESOLVED

I used the EnsureUser method which fixed it.

        SPUser usr = workflowProperties.Web.EnsureUser("domain\\sptest01");
        theTask.AssignedTo = usr.LoginName;
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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