stombiztalker

I have create a custom workflow activity and have deployed it to my server so that it can be used as a custom action. That is working good.

What I am doing now in this activity is creating a new document library based on input from the user like this:

SPSite site = new SPSite(Url);
SPWeb rootweb = site.OpenWeb();

SPListCollection lists = rootweb.Lists;

SPListTemplateType listTemplateType = new SPListTemplateType();

listTemplateType = SPListTemplateType.DocumentLibrary;

lists.Add(DocLibName, "", listTemplateType);

What I would like to also do is create a new task for the administrator (or I could input that name for someone) for the purpose of reminding them to go finish setting up the new document library. Since this is just a reminder, there is no need to wait for the task to change.

I'm somewhat new to the object model. How would I get the Tasks list and assign a task to the admin

Thanks!



Re: SharePoint - Workflow SPD custom action - sending a task to the admin

Unclepaul84

Code Snippet

SPList taskList = rootWeb.Lists["Tasks"];

SPListItem task = taskList.Items.Add();

task["Assigned To"] = "DOMAIN\administrator";

task["Title"] = "Finish setting up the list";

task.Update();