Passing a reference of the workflow to an activity RRS feed

  • Question

  • It there a way to pass in a reference of a workflow into an activity that the workflow is running (as an inargument)  in the Workflow designer?
    Thursday, September 2, 2010 8:33 PM


  • No, but if it is the right type of activity it will have this access already. You would need to use a custom NativeActivity, and then you can inspect the NativeActivityContext in the Execute override of the custom activity. This will give you access to all the features of the runtime, when a CodeActivity derived activity only gives you access to the arguments passed into the activity. Here are some additional details about the types of base classes available for custom activity authoring:


    Are you needing a reference to the currently running workflow that the activity is in, or another workflow or type of workflow? What is your scenario and if we can't do it exactly the way you envision we might be able to find an alternate way.


    Steve Danielson [Microsoft]
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm


    • Proposed as answer by Andrew_Zhu Monday, September 6, 2010 3:46 AM
    • Marked as answer by Andrew_Zhu Friday, September 10, 2010 6:15 AM
    Thursday, September 2, 2010 11:07 PM