Share via


SPContentType.UpdateWorkflowAssociationsOnChildren-Methode (Boolean, Boolean, Boolean, Boolean)

Verteilt die Änderungen in diesem Inhaltstyp Workflowzuordnungen von Inhaltstypen, die von diesem Inhaltstyp abgeleitet werden oder Instanzen dieses Inhaltstyps, die Listen oder beides angewendet wurden. Optional kennzeichnet Objekte, die von der Operation betroffen sind, als geändert. Optional unterdrückt auch Ausnahmen, die ausgelöst werden, da ein untergeordnetes Element entweder versiegelt oder schreibgeschützt ist.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Sub UpdateWorkflowAssociationsOnChildren ( _
    bGenerateFullChangeList As Boolean, _
    bPushdownDerivedCT As Boolean, _
    bPushdownListCTs As Boolean, _
    bThrowOnSealedOrReadOnly As Boolean _
)
'Usage
Dim instance As SPContentType
Dim bGenerateFullChangeList As Boolean
Dim bPushdownDerivedCT As Boolean
Dim bPushdownListCTs As Boolean
Dim bThrowOnSealedOrReadOnly As Boolean

instance.UpdateWorkflowAssociationsOnChildren(bGenerateFullChangeList, _
    bPushdownDerivedCT, bPushdownListCTs, _
    bThrowOnSealedOrReadOnly)
public void UpdateWorkflowAssociationsOnChildren(
    bool bGenerateFullChangeList,
    bool bPushdownDerivedCT,
    bool bPushdownListCTs,
    bool bThrowOnSealedOrReadOnly
)

Parameter

  • bGenerateFullChangeList
    Typ: System.Boolean

    true aller SPContentType -Objekte, die von diesem Vorgang betroffen sind, als geändert markiert; false nicht gespeichert.

  • bPushdownDerivedCT
    Typ: System.Boolean

    true Änderungen an diesen Inhaltstyp abgeleiteten Inhaltstypen weitergeben; andernfalls false.

  • bPushdownListCTs
    Typ: System.Boolean

    true Änderungen an der Listeninhaltstypen weitergeben basierend auf diesen Inhaltstyp; andernfalls false.

  • bThrowOnSealedOrReadOnly
    Typ: System.Boolean

    true auslösen eine Ausnahme bei Auftreten eines Inhaltstyps, das versiegelt oder schreibgeschützt ist; andernfalls false.

Ausnahmen

Ausnahme Bedingung
SPContentTypeSealedException

Die Sealed -Eigenschaft des ein untergeordnetes Element des Inhaltstyps hat den Wert true.

SPContentTypeReadOnlyException

Die ReadOnly -Eigenschaft des ein untergeordnetes Element des Inhaltstyps hat den Wert true.

Hinweise

Verwenden Sie diese Methode, um optional Weitergeben von Änderungen in den übergeordneten Inhaltstyp Workflowzuordnungen nach unten zu entweder abgeleitet oder Versionen von den Inhaltstyp oder beides aufgelistet. Wenn Sie false als Argument an den bGenerateFullChangeList -Parameter übergeben, SPContentType -Objekten, die durch diesen Vorgang betroffen sind, werden nicht als geändert markiert und OnChanged Ereignisse werden nicht ausgelöst. Übergeben false als Argument für den Parameter bThrowOnSealedOrReadOnly unterdrückt Ausnahmen ausgelöst, wenn Änderungen auf alle untergeordneten geschrieben werden können, weil er markiert ist als versiegelt oder schreibgeschützt.

Beispiele

Dim siteCollection As SPSite = New SPSite("https://localhost")
Dim site As SPWeb = siteCollection.OpenWeb()

Dim siteContentType As SPContentType = site.ContentTypes("Test Document")
Dim taskListTitle As String = "Tasks"
Dim historyListTitle As String = "Workflow History"
Dim workflowName As String = "Red-Yellow-Green"

' Get a template.
Dim workflowTemplate As SPWorkflowTemplate = Nothing
For Each template As SPWorkflowTemplate In site.WorkflowTemplates
    workflowTemplate = template
    ' We'll take a template everyone has.
    If workflowTemplate.Name = "Three-state" Then
        Exit For
    End If
Next template

' Create an association.
Dim workflowAssociation As SPWorkflowAssociation = _
          SPWorkflowAssociation.CreateSiteContentTypeAssociation(workflowTemplate, _
                                                                 workflowName, _
                                                                 taskListTitle, _
                                                                 historyListTitle)

' Add the association to the content type or update it if it already exists.
Console.Write("Workflow association {0} has been ", workflowAssociation.Name)
If siteContentType.WorkflowAssociations.GetAssociationByName(workflowAssociation.Name, site.Locale) Is Nothing Then
    siteContentType.AddWorkflowAssociation(workflowAssociation)
    Console.WriteLine("added")
Else
    siteContentType.UpdateWorkflowAssociation(workflowAssociation)
    Console.WriteLine("updated")
End If

' Propagate to children of this content type.
siteContentType.UpdateWorkflowAssociationsOnChildren(False, True, True, False) ' Suppress exceptions

' Clean up.
site.Dispose()
siteCollection.Dispose()
SPSite siteCollection = new SPSite("https://localhost");
SPWeb site = siteCollection.OpenWeb();

SPContentType siteContentType = site.ContentTypes["Test Document"];
string taskListTitle = "Tasks";
string historyListTitle = "Workflow History";
string workflowName = "Red-Yellow-Green";

// Get a template.
SPWorkflowTemplate workflowTemplate = null;
foreach (SPWorkflowTemplate template in site.WorkflowTemplates)
{
    workflowTemplate = template;

    // We'll take a template everyone has.
    if (workflowTemplate.Name == "Three-state") break;
}

// Create an association.
SPWorkflowAssociation workflowAssociation =
    SPWorkflowAssociation.CreateSiteContentTypeAssociation(workflowTemplate,
                                                           workflowName,
                                                           taskListTitle,
                                                           historyListTitle);

// Add the association to the content type or update it if it already exists.
Console.Write"Workflow association {0} has been ", workflowAssociation.Name);
if (siteContentType.WorkflowAssociations.GetAssociationByName(workflowAssociation.Name, site.Locale) == null)
{
    siteContentType.AddWorkflowAssociation(workflowAssociation);
    Console.WriteLine("added.");
}
else
{
    siteContentType.UpdateWorkflowAssociation(workflowAssociation);
    Console.WriteLine("updated.");
}

// Propagate to children of this content type.
siteContentType.UpdateWorkflowAssociationsOnChildren(false,  // Do not generate full change list
                                                     true,   // Push down to derived content types
                                                     true,   // Push down to list content types
                                                     false); // Do not throw an exception if sealed or readonly  

site.Dispose();
siteCollection.Dispose();

Siehe auch

Referenz

SPContentType Klasse

SPContentType-Member

UpdateWorkflowAssociationsOnChildren-Überladung

Microsoft.SharePoint-Namespace

AddWorkflowAssociation

Weitere Ressourcen

Introduction to Workflows in Windows SharePoint Services

Workflow Stages