Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com
Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com
Below is an extension method  to find root Parent Workflow of current activity
  /// <summary>
  /// Get root Parent Workflow of current activity
  /// <param name="activity"></param>
  /// <returns></returns>
  public static Activity FindRootWorkflow(this Activity activity)
  {
   List<string> list = new List<string>();
   Activity act = activity;
   while (act != null)
   {
    if (act.Parent==null)
    {
     return act;
    }
    act = act.Parent;
   }
   return null;
  }
 
It was  asked in MS Connect Suggestion "Activity to access Parent workflow or Root Workflow"
 


 

Posted on Friday, July 23, 2010 6:01 PM Workflow | Back to top


Comments on this post: Extension method to find root Parent Workflow of current activity

# re: Extension method to find root Parent Workflow of current activity
Requesting Gravatar...
Or in recursive form:

public static Activity FindRootWorkflow(this Activity activity)
{
var parent = activity.Parent;
return parent == null ? activity : FindRootWorkflow(parent);
}
Left by Ryan on Jul 23, 2010 11:29 PM

Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net