SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created State Machine Workflow regarding on Client Requirement Avery thing is working fine but Approver name not available in Assigned To in Task list field but Task is Created.

string Name_approver; ( This value Coming From SQL DB )

private void createTask1_MethodInvoking(object sender, EventArgs e) {

        createTask1_TaskId1 = Guid.NewGuid();
        createTask1_TaskProperties1.Title = workflowProperties.Item.Title;
        createTask1_TaskProperties1.AssignedTo = Name_approver;  **Here i hava a problem Please Help***
        //createTask1_TaskProperties1.ExtendedProperties["APPROVERNAME"] =  Name_approver;
        createTask1_TaskProperties1.ExtendedProperties["level"] = _IPFID;

        createTask1_TaskProperties1.ExtendedProperties["Invoice No"] = InvoiceNo;
        createTask1_TaskProperties1.ExtendedProperties["Invoice Date"] = InvoiceDate;
        createTask1_TaskProperties1.ExtendedProperties["Invoice Amount"] = InvoiceAmount;
        createTask1_TaskProperties1.ExtendedProperties["Invoice Duedate"] = InvoiceDuedate;
        ////createTask1_TaskProperties1.ExtendedProperties["Status"] = Status;

        createTask1_TaskProperties1.ExtendedProperties["Vendor Name"] = vendorname;
        createTask1_TaskProperties1.ExtendedProperties["Invoice_ServiceDate"] = InvoiceServiceDate;

share|improve this question

Are you connected to the SQL DB in your WF solution and referencing that database?

You should be able to query the database and return your result (which will be a username) and pass that parameter to the string.

SqlConnection sqlConnection1 = new SqlConnection("Your Connection String");
SqlCommand cmd = new SqlCommand();
SqlDataReader reader;

cmd.CommandText = "SELECT * FROM YourTable";
cmd.CommandType = CommandType.Text;
cmd.Connection = sqlConnection1;


reader = cmd.ExecuteReader();
// Data is accessible through the DataReader object here.


Otherwise, for "Assigned To" you can just use "DOMAIN\username" to assign the appropriate task to a user or for a SharePoint group try:

createSPTask_TaskProperties1.AssignedTo = "SharePoint Group"
share|improve this answer
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. – John Chapman Oct 29 '12 at 21:30

Your Answer


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.