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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to schedule activity loaded from external source inside NativeActivity

Posted By:      Posted Date: August 30, 2010    Points: 0   Category :Windows Application
I have a NativeActivity that takes an InArgument<int> that is the primary key of some table that contains a piece of xaml. When the activity runs, it loads the xaml from the database and uses ActivityXamlServices to turn the xaml into an activity. Then I try to schedule the activity using NativeActivityContext.ScheduleActivity. This fails with the message: The provided activity was not part of this workflow definition when its metadata was being processed.  The problematic activity named 'Sequence' was provided by the activity named 'RunWorkflowFromStore'. This makes sense because I never added the activity I'm trying to run to the metadata. However, when can I do that? It is only at runtime that I know the value of the primary for the xaml I'm trying to load. Or am I doing this the wrong way? Here is my code: public sealed class RunWorkflowFromStore : NativeActivity<ApprovalState> { private Activity _activity; public InArgument<int> WorkflowId { get; set; } protected override void CacheMetadata(NativeActivityMetadata metadata) { var workflowIdArgument = new RuntimeArgument("WorkflowId", typeof(int), ArgumentDirection.In); metadata.Bind(WorkflowId, workflowIdArgument); metadata.AddArgument(workflowIdArgument); } protected override void Execute(NativeActivityContext context) { // Load activity

View Complete Post

More Related Resource Links

Creating a SharePoint 2010 Web Part That Can Read and Write Data to an External Data Source

Learn to use Visual Studio 2010 to create a Visual Web Part that uses a BCS external content type in SharePoint Server 2010 to read and write data to the AdventureWorks sample database.

Sample: Creating a SharePoint 2010 Web Part That Can Read and Write Data to an External Data Source

Explore the code in this visual how-to article as you learn to use Visual Studio 2010 to create a Visual Web Part that uses a BCS external content type in SharePoint Server 2010.

No symbols are loaded for any call stack frame. The source code cannot be displayed.

Hello.I installed VisualStudio.NET 2005 a few days ago.  ( not beta )While I'm debugging, I'm faced with strange message box.-- MessageBox --No symbols are loaded for any call stack frame. The source code cannot be displayed. -- Debug Detail Window --FatalExecutionEngineError was detectedMessage: The runtime has encountered a fatal error. The address of the error was at 0x7a2b5aec, on thread 0x358. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.How should I solve this problem?Please answer me..Thanks.Gwisun.

Connecting a Sharepoint Custom list with an external Data-source

Hi I am planning to connect a Sharepoint Custom list with an external Data-source. External DB will be in Access 2007 format. More Information: I need a solution that we can connect our sharepoint list (one-way) to online db in a way that new  information is directly updated in the sharepoint list, whilst other info changed in sharepoint list  is not synced back to original value. Is there a way to solve this? -saumil

Refer Rows/values of OLEDB Source inside DFT

I have a Data Flow task that implement Insert/Update using logic:  http://social.msdn.microsoft.com/forums/en-US/sqlintegrationservices/thread/131dbe38-95a9-4b64-8434-60ba3cd6de00/. Now I want to also include "Delete" just after the OLEDB Source where I will delete from Target Table if the Rows are present in Target and No in the OLEDB Source. So what control I should use and how do I refer to the OLEDB Source records. May be something like: Delete from dest_table where ID NOT IN (SELECT ID from OLEDBSourceControlRecords)... Thanks, Prabhat

Microsoft Excel and Sharepoint KPI's (External Data Source)

This is my first post i hope i get a clear answer for my question. I recenty have been working on KPI's drawn from Microsoft Excel documents that i created. However, as we know, external data sources in excel don't work with sharepoint. If that was possible it would have saved the company a lot of time and effort My questions are: Is there any way to have external data sources with some advanced modifications, or any other way that would simulate this process? (External data update) Can i directly update my data by tampering the database where the excel file is saved?   I don't know if the files uploaded in sharepoint are stored in a database, so i want some validation around this. (Name of the database, path etc.)   Hope you can shed some light to my questions Thanks in advance Theo

Display photo on MOSS site from external source

Hi, I am using Visual Studio 2008 and MOSS 2007. I want to develop one custom web part which will show photo of the day from one particular group of Flicker photo site.tant links. Can anyone suggest me best approach to achieve this? I would appreciate, if anyone can send me some related impor

CacheMetadata is not called when a custom activity is placed inside a flowchart

I wrote a simple Native activity which implements CacheMetadata(NativeActivityMetadata metadata) to declare arguments and variables. The activity works great but when I tried to use it inside a flowchart activity I found out that CacheMetadata is not called by visual studioo when the activity is dragged from the toolbox into the flow chart . This of course prevents my activity from working correctly. How can a custom activity be used inside a flowchart activity if CacheMetadata not called? Is there a way to make CacheMetadata run when the custom activity is placed inside a flowchart activity? Thanks Manu    

Create task activity break out inside a While loop

Hi I have developed a sharepoint state machine workflow. I want to assign a same task to more than one users, but unfortunatly, I cannot give the attribute "AssignTo" to more users in the code, even like this:"this.workflowTask1Properties.AssignedTo = "mydomain\\user01;mydoman\\user02", that will result in an empty value to the attribure.So, I involved the createtask activity in a While loop so I can asign deferent user in each loop, but It's very stange,  the loop always stopped in the second time, does anybody have met this issue?I have referensed Amit's question:http://social.msdn.microsoft.com/forums/en-US/windowsworkflowfoundation/thread/b238978d-f330-420c-823e-b77b0e19414d?prof=requiredbut I have no define the "correlation refernce " in my workflow.my code is here:public SPWorkflowTaskProperties workflowTask1Properties;public int abc;...private void OnWorkflowActivated(object sender, ExternalDataEventArgs e)        {            ...           this.abc = 0;           ...        }...private void CreateTask1(object sender, EventArgs e)        { 

Connect to a external data source.

Hello, my name is Jorge Graur. I am using the SharePoint 2010 Enterprise. I am trying to create a "Custom List" with a connection to SQL Server. After being created in the List Setings of a  list, can not find the option "Connect to the external data source." What is required to configure to this option appear?. thanks,

Want to Load and schedule a child activity from a database

I've been looking at other threads for this answer and it does not seem to exist. The DynamicActivity created by ActivityXamlServices cannot be scheduled as a child of another Activity (for instance a NativeActivity) unless it is instantiated in the constructor, which precludes using an input argument as a database key. My conclusion is that the only pattern for storing XAML in a database is when the XAML contains the entire Workflow. This is not very useful if you want to dynamically select your Workflow based on some parameter that may be an input argument to the Workflow. For my application, this greatly limits the usefulness of WF 4.0. Does anyone have a solution to this problem?------------------------ Mark Northup

How can i access to params and args defined in parent activity from custom NativeActivity


There is a scenario that the custom NativeActivity need to access to params or args defined in parent activity. What i have done as below

 protected override void Execute(NativeActivityContext context)


   WorkflowInstanceProxy proxy = context.GetExtension<WorkflowInstanceInfo>().GetProxy();

   Activity root = proxy.WorkflowDefinition;

   Activity rootChild = WorkflowInspectionServices.GetActivities(root).ElementAt(0);

   EditingContext ec = new EditingContext();

   ModelTreeManager mtm = new ModelTreeManager(ec);


   ModelItem modelItem = mtm.Root;

   ModelProperty c1 = modelItem.Properties["Variables"];

   ModelItemCollection c2 = c1.Collection;

   dynamic c3 = c2[0].GetCurrentValue();

   string value = c3.Get(context);


Apparently it is not possible to access to external params with local context so the error prompt "An activity can only access its own implementation variables."

My question is how to get it ? Is there another easy way to do so ?



be together be stro

SharePoint Designer 2010 External Content Types Data Source Already Exists in Business Data Connecti


I used the Secure Store to create connection in SharePoint 2010 Designer External Content Types Data Source Explorer.  Later I changed some column names in the table.  I deleted the connection from Data Source Explorer and recreated it. I right clicked on the table and selected Create All Operations. When I clicked the Finish button, I got "The system definition with the same name as this data source already exists in the Business Data Connectivity Metadata Store and it refers to a different data source.  Cannot complete operation generation.  Add a connection to this data source with a different name and try again." 

I re-created the Secure Store using a different name in SharePoint 2010 Central Administration.  I didn't find the option to choose the connection name in SharePoint 2010 Designer. After I clicked Add Connection, I entered the Database Server and the Database Name, selected Connect with Impersonated Window Identity, entered Secure Store name, and clicked OK. The connection created with the database name as before.

How to disable delete command for certain activities inside the composite activity



I had build up a composite activity, this composite activity basically contains a few activities, some of the activities are not allowed to delete. Is there a way to disable the delete command using WF APIs, instead of hooking up the keydown and context menu event for those activities?


Addressing Source Control on Controller for custom activity



I have read the blog posted regarding of source control address on controller by Ewlad Hofman, but I can't still seem to figure out how to have my custom activity working on my team server.

I have checked in simply everything (solution file, all related folders, codes, .xaml template file, etc.)

I'm just not sure which directory I should put for the controller to recognize my custom activity. Ah, the statement about that HostEnvironmentOption.All thing is already included in the .cs code.

State Machine Workflow + External Event + Delay activity



I have state machine workflow with a state contain 2 event driven activities, one is waiting for an external event, and second one is delay. If the external event didn't happen within specified time, timeout occurs and send email. But if the external event delivered, it transited to next state.


Both situation works fine. But once the external event occurred and transited to next state, the delay activity time out happens and it sends the mail. I don't want it happen, When i read through various blog, I learnt that once the workflow instance moved to next state, all event subscriptions related to the previous state are removed from the queue.... But it is not happening in my situation

Kindly help me to find where i am going and to resolve this issue..


p.s I set manualworkflow scheduler  - useActiv

Set the InArgument values of a CodeActivity inside NativeActivity


Inside my Native Activity:

//Operation holds the object of Add activity mentioned in the below code.
public Activity Operation { get; set

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