CreateTaskWithContentType Class
Defines a workflow activity that is used to create a task item in a Microsoft SharePoint Foundation 2010 task list, using a specified SharePoint Foundation 2010 content type.
System.Object
System.Workflow.ComponentModel.DependencyObject
System.Workflow.ComponentModel.Activity
System.Workflow.Activities.CallExternalMethodActivity
Microsoft.SharePoint.WorkflowActions.CreateTaskWithContentType
System.Workflow.ComponentModel.DependencyObject
System.Workflow.ComponentModel.Activity
System.Workflow.Activities.CallExternalMethodActivity
Microsoft.SharePoint.WorkflowActions.CreateTaskWithContentType
Assembly: Microsoft.SharePoint.WorkflowActions (in Microsoft.SharePoint.WorkflowActions.dll)
|
The following code sample was contributed by Robert Bogue, one of the SharePoint Foundation MVPs. Get to know your SharePoint Foundation MVPs on this Web site. |
The following code sample updates a content type.
public static void VerifyModifyTaskList(SPList taskList, string contentType) { try { SPContentTypeId contentTypeId = new SPContentTypeId(contentType); taskList.ContentTypesEnabled = true; SPContentTypeId matchContentTypeId = taskList.ContentTypes.BestMatch(contentTypeId); if (matchContentTypeId.Parent.CompareTo(contentTypeId) != 0) { SPContentType ct = taskList.ParentWeb.AvailableContentTypes[contentTypeId]; taskList.ContentTypes.Add(ct); taskList.Update(); } } catch { throw; } }
