.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

Programmatically editing a XAML workflow?

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :JQuery

I want to be able to load a XAML workflow, programmatically edit the values of the InArguments of some of the activities, and then run the workflow. I can do steps 1 and 3 but can't figure out how to edit the InArguments.

Can anyone point me in the right direction? Thanks.

View Complete Post

More Related Resource Links

Display XAML workflow image in browser and hightlight the current Activity

I have a requirement in project to display the XAML workflow in browser as image like the Visual studio designer displaying and it should Hightlight the current activity in workflow.  Please guide me on this.rajeevkalyan

Hosted Designer fails to load workflow xaml that has InArguments with default values (xaml saved by

I have hosted the designer in our app. Using the hosted designer, workflows are saved as xaml to a database. When an end user wishes to edit a workflow the xaml is downloaded to a file and loaded into the designer via the .xaml file. The user can also associate assemblies with the workflow and there is a mechanism which makes sure that these assemblies are loaded into the appdomain and available. The problem we are hitting occurs when the top level activity (Sequence) has InArgument with default value. I create a simple Sequence, add InArguments (type of Int32 and String)  and set some default values. I save the workflow xaml to the database and close down the designer. When I wish to edit the workflow and try to load I get the following errors Could not find member '{clr-namespace:}_e905.argument3'. Could not find member '{clr-namespace:}_e905.argument1'. suggesting that some assembly/namespace missing. Here is the xaml I try to load: <Activity mc:Ignorable="sap" x:Class="{x:Null}" this:_e905.argument3="99" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:s="clr-namespace:System;assembly=mscorl

How to start a workflow programmatically that was created in Sharepoint designer 2010?

Trying to start a workflow from code.  The workflow itself has been created in SPD 2010, which from what I understand, means that there is no assembly until the first time it's ran.  However, when I try to find the association record, that doesnt exist.  Is this becuase the 'code' hasnt been compiled yet?  If so, how can I have sharepoint start the just-in-time compiler for a declarative based workflow, so that can kick it off with in code? tia Rocky SandersRocky Sanders

Error editing a document that is running a workflow

After workflow is started i try edit document, but this error is displayed: System.ArgumentNullException: Value cannot be null.  Parameter name: s     em System.IO.StringReader..ctor(String s)      em System.Xml.XmlDocument.LoadXml(String xml)      em Microsoft.SharePoint.Publishing.Internal.WorkflowUtilities.FlattenXmlToHashtable(String strXml)      em Microsoft.SharePoint.Publishing.Internal.WorkflowUtilities.DoesWorkflowCancelWhenItemEdited(String associationXml)      em Microsoft.SharePoint.Publishing.WebControls.ConsoleDataSource.EnsurePageNotInLockingWorkflowIfInEditMode()      em Microsoft.SharePoint.Publishing.WebControls.ConsoleDataSource.LoadDataSource()      em Microsoft.SharePoint.Publishing.WebControls.ConsoleDataSource.OnLoad(EventArgs e)      em Microsoft.SharePoint.Publishing.WebControls.XmlConsoleDataSource.OnLoad(EventArgs e)      em Microsoft.Share.Point.Publishing.WebControls.PublishingSiteActionsMenuCustomizer.OnLoad(EventArgs e)      em System.Web.UI.Control.LoadRecursive()      em System.Web.UI.Control.LoadRecursive()      em System.Web.UI.Control.L

How to create a workflow programmatically?

Are there any samples that would show how to create and/or modify a workflow programmatically, i.e. from a program, not from VS.NET IDE or a hosted designer? For example, the program would create a new workflow, add a couple of activities to it, and save the serialized workflow definition (in a file or database). I can find examples explaining how to modify a workflow instance at run time, but I need to create a workflow definition, not the instance. Any hints? Thanks.Alek

Workflow designer causes VS 2010 RTM to freeze when editing build process template.

I have a Dell Studio 1747 laptop with Intel i7 1.6GHz, 6GB RAM, Windows 7 Professional x64. I recently "updated" VS 2010 RC to RTM (removed all of RC and installed RTM). So far so good. Also, I have TFS 2010 RTM on the machine working perfectly, and have two team projects in there. Now, on a given solution, I copied DefaultTemplate.xaml to NewDefaultProcessTemplate.xaml and checked it in. I check it out and open it, and the workflow designer shows up. Then, I "Expand All" and go down to the "Compile, Test, and Associate Changesets and Work Items" section. If I click a subsection to collapse it, the mouse cursor changes to an hourglass and stays like that indefinitely. Sometimes, after a couple of minutes, the action is performed; then, it happens again up to a point where VS completely freezes. I have cleared VS 2010 cache, and have performed a repair on VS 2010 and TFS 2010 (just in case) to no avail. I have even disconnected from TFS right after openning the file, and still the same issue. This is f****** extremely frustrating. I can't do anything on the workflow designer. HELP !!!!!

Input parameters from Workflow No-Code Or Xaml Only

I have many activities and a customized workflow Only Xaml and I can not pass a value to a property of a custom activity, following the example of Workflow1.xoml   <pre lang="x-xml"><SequentialWorkflowActivity x:Name="Workflow1" xmlns:ns0="clr-namespace:CustomActivities;Assembly=CustomActivities, Version=, Culture=neutral, PublicKeyToken=null" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/workflow"> <ns0:ReadLineActivity x:Name="readLineActivity1" InputText="" /> <ns0:WriteLineActivity x:Name="writeLineActivity1" OutputText="{ActivityBind readLineActivity1,Path=InputText}" /> </SequentialWorkflowActivity> based on this workflow I pass a value for the property InputText activity readLineActivity1   Thanks a lot!

XAML Workflow Definition into SQL database


I have created a workflow using VS 2010 Beta2. Later I have created a table and stored the whole XAML workflow definition into database. My Idea is to invoke the worklfow using the ActivityXAMServices. But I am facing lot of issues. Please let me know wether we can invoke the workflow using the  ActivityXAMServices for the workflow created by VS 2010 beta 2? I am facing lot of issues about the local variales. 

 Please any one can let me know how can I invoke the workflow which is stored in database and later on invoke the workflow through the  ActivityXAMServices or any othre way is there?

Please go through the following code:


string deoXaml = utild.getWorkflowDefinition(workflowName);


Programmatically Complete Designer Workflow

I have a SharePoint Designer Workflow that spawns a task when a new item is created in a SharePoint list.  I want to be able to complete the task and the workflow programmatically.  I'm able to complete the task successfully, but the workflow itself refuses to terminate and is always listed as "In Progress", no matter what I try.

I've seen many people ask this question, but I can't get it to work.  What am I missing?

Here's what I'm currently trying:


// get the current task item


SPListItem li = SPContext.Current.ListItem;


// mark the task complete



Reuse XAML Declarative Workflow in Workflow Service (xamlx) Results in Server Error of System.Argume


We attempted to reuse a XAML (declarative activity workflow) in a few places within the same XAMLX and it doesn't appear to allow this.   On the WCF client side, it reported an obscure error of something to the effect of unknown message received and a communication error stating the service instance couldn't be used at this time and to ensure the call order is correct or order delivery guarantee is enabled.   However, this appears to mask the true issue which is on the server side.   Apparently, when the server side WCF end point is trying to start the workflow instance, it throws this error building a dictionary of workflow children...

System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Activities.Debugger.InstrumentationTracker.InitializeUninstrumentedSubRoots()
   at System.Activities.Debugger.DebugManager.EnsureInstrumented(Activity activity)
   at System.Activities.Debugger.DebugManager.OnEnterState(ActivityInstance instance)
   at System.Activities.Debugger.DebugController.ActivityStarted(ActivityInstance activityInstance)

SP Workflow issue -> "The item is currently locked for editing. Waiting for item to be checked in o



I'm getting the above issue with my List Workflow.  I've created a workflow that assigns column data to a file when it is created.  This works some of the time; however, at random intervals the workflow will get stuck with "In Progress" status for the reason listed above.  The only way to clear this status is to delete the workflow and republish it.  This happens when copying a document via the UI, as well as when copying a document via UNC path.  

If I terminate the workflow for the stuck item, when I go back to run it manually, the workflow isn't even listed.  Looking at the Visio history for the item, it seems to be getting stuck at different methods within the workflow; sometimes it gets stuck at a logic method, other times at a data manipulation method.  And other times it runs through fine without any issues.  This is all happening with the same file used as a control, so it's not like I'm introducing variable triggers to the methods in this workflow.



SP2010 VS workflow: editing a running workflow


I have created a workflow on a "projects" list, which has a "collaborators" field - a lookup field that can contain more values.

When i create a new project i want to notify all the involved collaborators i choose with a mail. So i have the workflow that creates the various tasks (one for each collaborator). The workflow activates when a new project is created, but also when an existing one it's modified, beacuse if the collaborators have changed i need to send a mail to the new collaborators involved in the project.

It all works fine except that if i already have a running workflow (with some uncompleted tasks) when i add some new collaborators to a project, the new tasks for these collaborators won't be created, because there is still the older workflow running.
I need a way to know if there is already a workflow running, thus not starting a new one and modiffy the old one adding a task for every new collaborator
Looking at the workflow toolkit i see the element "onWorkflowItemChanged_Invoked", which seems to be the thing i need, but it doesn't act as hoped...

Is there a way to do what i'm looking for?

Cannot use an existing contract to design a xaml workflow


I am trying to use a contract first approach in designing Workflows but am facing problems. 

For Eg. If I have a Service Contract

[ServiceContract (Namespace="http://abc.com")]


    public interface IRegistry



        [FaultContract(typeof (CustomFault))]

        List<string> Update1(string projectToAdd);



        List<string> Update2(string projectToAdd);


I set the ServiceContract name as {http://abc.com/}IRegistry for the receive activity. But I was not able to make it hookup to the interface where I have a service attribute attached. 

How can I make sure that I implement the same interface when building a workflow in the designer. I was able to implement the same in a coded workflow though. Or even if I use a WorkFlowServiceHost I am able to attach service behaviors but am unable to do so without a WorkFlowServiceHost.

Bottom line is that is there any way we can use a Contract first approach for a XAML workflow and not a cod

Initiating A Workflow Programmatically


I want to initiate a workflow by using SPWorkflowManager.StartWorkflow method with the user with no privileges to do so; I was using RunWithElevatedPrivileges but this causes a problem, it makes System Account the initiator of the workflow but I want the current user to be the initiator of the workflow, kindly suggest what needs to be done.

Initiating A Workflow Programmatically


I want to initiate a workflow by using SPWorkflowManager.StartWorkflow method with the user with no privileges to do so; I was using RunWithElevatedPrivileges but this causes a problem, it makes System Account the initiator of the workflow but I want the current user to be the initiator of the workflow, kindly suggest what needs to be done.

Is there a plan to support a custom activity type as a root document in xaml on VS workflow designer



Referring to the post below. It seems that the current VS workflow designer only support "Activity" type as a root document. Is there a plan to support a custom activity type as a root document in xaml on next release of WF?




Workflow for the creation and editing of sites within a site collection


Hi there.

How would you go about creating a workflow for the creation and editing of sites within a site collection?

I'm assuming users would have different roles such as Approvers and Authors.


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend