Attempts to return a reference to the workflow that contains the activity.
Namespace: Microsoft.ResourceManagement.Workflow.Activities
Assembly: Microsoft.ResourceManagement (in microsoft.resourcemanagement.dll)

Usage

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

returnValue = SequentialWorkflow.TryGetContainingWorkflow(activity, containingWorkflow)

Syntax

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

Parameters

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.

Example

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

  Copy Code
SequentialWorkflow parentWorkflow = null;
if (SequentialWorkflow.TryGetContainingWorkflow(this, out parentWorkflow))
{
	this.requestId = parentWorkflow.RequestId;
	this.actorId = parentWorkflow.ActorId;
}
else
{
	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.

Platforms

Target Platforms

Windows 2008 x64 Edition

Change History

See Also