SequentialWorkflow.TryGetContainingWorkflow Method

Attempts to return a reference to the workflow that contains the activity.

Namespace: Microsoft.ResourceManagement.Workflow.Activities
Assembly: Microsoft.ResourceManagement (in Microsoft.ResourceManagement.dll)


Dim activity As Activity
Dim containingWorkflow As SequentialWorkflow
Dim returnValue As Boolean

returnValue = SequentialWorkflow.TryGetContainingWorkflow(activity, containingWorkflow)


Public Shared Function TryGetContainingWorkflow ( _
    activity As Activity, _
    <OutAttribute> ByRef containingWorkflow As SequentialWorkflow _
) As Boolean
public static bool TryGetContainingWorkflow (
    Activity activity,
    out SequentialWorkflow containingWorkflow
static bool TryGetContainingWorkflow (
    Activity^ activity, 
    [OutAttribute] SequentialWorkflow^% containingWorkflow
public static boolean TryGetContainingWorkflow (
    Activity activity, 
    /** @attribute OutAttribute() */ /** @ref */ SequentialWorkflow containingWorkflow


  • activity
    An activity.
  • containingWorkflow
    An output parameter that refers to the workflow that contains the activity passed to the method.

Return Value

Returns a Boolean value that indicates if the attempt to locate the workflow that contains the activity was successful.


The following example is a code snippet of an activity that is accessing its containing workflow in order to read its properties.

SequentialWorkflow parentWorkflow = null;
if (SequentialWorkflow.TryGetContainingWorkflow(this, out parentWorkflow))
      this.requestId = parentWorkflow.RequestId;
      this.actorId = parentWorkflow.ActorId;
      throw new InvalidOperationException("This activity must run within the context of a FIM SequentialWorkflow.");

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003 , Windows Server 2008, and Windows 2000

Target Platforms

Change History

See Also


SequentialWorkflow Class
SequentialWorkflow Members
Microsoft.ResourceManagement.Workflow.Activities Namespace