CreateTaskWithContentType-Klasse
Definiert eine Workflowaktivität, die verwendet wird, um ein Aufgabenelement in einer Aufgabenliste Microsoft SharePoint Foundation 2010, das mit einem angegebenen SharePoint Foundation 2010 Inhaltstyp zu erstellen.
Vererbungshierarchie
System.Object
System.Workflow.ComponentModel.DependencyObject
System.Workflow.ComponentModel.Activity
System.Workflow.Activities.CallExternalMethodActivity
Microsoft.SharePoint.WorkflowActions.CreateTaskWithContentType
Namespace: Microsoft.SharePoint.WorkflowActions
Assembly: Microsoft.SharePoint.WorkflowActions (in Microsoft.SharePoint.WorkflowActions.dll)
Syntax
'Declaration
<ToolboxBitmapAttribute(GetType(CreateTaskWithContentType), "Resources.CreateTaskWithContentType.bmp")> _
<ActivityToolboxDisplayAttribute("VSTTSharePointWorkflowTask", True)> _
Public NotInheritable Class CreateTaskWithContentType _
Inherits CallExternalMethodActivity
'Usage
Dim instance As CreateTaskWithContentType
[ToolboxBitmapAttribute(typeof(CreateTaskWithContentType), "Resources.CreateTaskWithContentType.bmp")]
[ActivityToolboxDisplayAttribute("VSTTSharePointWorkflowTask", true)]
public sealed class CreateTaskWithContentType : CallExternalMethodActivity
Hinweise
Sie müssen sicherstellen, dass in der Aufgabenliste SharePoint Foundation Inhaltstypen aktiviert sind, in dem Sie die Aufgabe Listenelemente erstellen. Wenn sie nicht in dieser Liste aktiviert sind, wird die Aktivität eine ein Nullverweis (Nothing in Visual Basic) Verweis-Ausnahme ausgelöst.
Beispiele
![]() |
Das folgende Codebeispiel wurde durch Robert Bogue, eines der SharePoint Foundation MVPs bereitgestellt. Lernen Sie Ihre SharePoint Foundation MVPs auf dieser Websitekennen. |
Im folgenden Codebeispiel wird einen Inhaltstyp aktualisiert.
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;
}
}
Public Shared Sub VerifyModifyTaskList(ByVal taskList As SPList, ByVal contentType As String)
Try
Dim contentTypeId As New SPContentTypeId(contentType)
taskList.ContentTypesEnabled = True
Dim matchContentTypeId As SPContentTypeId = taskList.ContentTypes.BestMatch(contentTypeId)
If matchContentTypeId.Parent.CompareTo(contentTypeId) <> 0 Then
Dim ct As SPContentType = taskList.ParentWeb.AvailableContentTypes(contentTypeId)
taskList.ContentTypes.Add(ct)
taskList.Update()
End If
Catch
Throw
End Try
End Sub
Threadsicherheit
Alle öffentlichen static (Shared in Visual Basic) Member dieses Typs sind threadsicher. Die Threadsicherheit von Instanzmembern ist nicht gewährleistet.