Cancel Handler for workflow not execute (SharePoint 2010) - visual-studio

I'm developing workflows on SharePoint 2010 using Visual Studio.
I need to catch event, when user cancel running workflow from UI.
User clicks on "Terminate this workflow now" link and I should add some logs to history of current workflow instance.
I added cancellationHandlerActivity for my SequentialWorkflowActivity, but cancellationHandlerActivity is not executed.
In MSDN I find explanation for cancellationHandlerActivity (http://msdn.microsoft.com/en-us/library/aa349442(v=vs.85).aspx) - The CancellationHandlerActivity activity contains cleanup logic for a composite activity that is canceled before all the composite activity's child activities are finished executing.
So I thought, that cancellationHandlerActivity is what I need, but on practice - I'm wrong :(
Please, give me some advice, how i can solve my problem!
I tried to find solution on the Internet, but couldn't :(

I found solution!
You can create your custom WrkStatPage and add your custom action on cancel event.
(More information about this way)
Also in Element.xml for your workflow add property
StatusUrl="_layouts/MyCustomWrkStat.aspx"

Related

SharePoint 2013 Visual Studio workflow breakpoint not hit

I'm using VS 2013 and a SP 2013 farm solution which contains a workflow.
I'm desperately trying to debug my workflow to gain some inside information.
This is what I tried so far:
First of all I set a breakpoint on a GetCurrentItemId Activity
Next I hit F5.
The workflow test host console opens up and the web browser showing my sharepoint site
Next I navigate to my list and start the workflow on any (single) item
The workflow test console stays all black - not a single piece of information to find here
The workflow's internal status changes to "Completed".
...obviously my breakpoint has not been hit. WHY? :(
Solved
Reinstalling VS 2013 did in fact help.
From what I can see you have been starting your workflow in debug mode and trying to debug in on a list event.
Instead of doing that try adding your breakpoints (I always add breakpoint in the first scope) and then go to
Debug -> Attach to Process and look for Microsoft.Workflow.ServiceHost.exe and click attach.
Before doing any work with that list items to trigger the workflow verify that your breakpoints are active - if not try retracting your solution and redeploy, then one more time try attaching it to the WF service.
Hope it helps.
When you attach to the process Microsoft.Workflow.ServiceHost.exe you must select the type of code you will attach to. Just select Workflow and you´ll be able to see the workflow context variables.

InstallShield add custom action to check for anti-virus

I am a bit of a beginner at InstallShield (in the sense that this is the first time I've used it!).
I have some code that I am packaging up in a .net DLL to check for the existence of anti-virus. The installer I am attempting to create must check for anti-virus (by calling a custom action using my DLL?) and cancel the install if none has been found.
The way I seen it working, was the user would see a dialog that is informational ("about to check for anti-virus"), the user would press "Next" it would call the custom action and then show a success screen with a "Next" button, or a failure screen with "Finish" button.
Is this sort of thing possible with InstallShield? Are there any good tutorials out there for doing this sort of thing?
Do you really need a custom action? Do you have more detailed requirements with regards to what products and versions you are looking for?
InstallShield / Windows Installer has a built in search pattern that can look for registry entries, files, et al.
If you really do need a custom action, how long do you expect the execution to take? If it's only a couple seconds, just schedule it to run after AppSearch. You don't need a UI to say "now doing blah" just do it.
Since you want to do this in .NET, you need to look at Windows Installer XML (WiX) Deployment Tools Foundation (DTF). You can use this to author/compile custom action DLL's that InstallShield can then consume. Generally the custom action should do it's search and then set a property based on it's result. Then use that property in evaluating whatever business rule you are trying to implement.

Worksheet_SelectionChange event in xla add-in

Is to possible to trigger Worksheet_SelectionChange event in xla add-in. I put the code in Worksheet module of add-in. but it did not enter into this module. My target is to set the comment box in the center of active window. I got the code from here. Please help me.
You need to work with Application-level events if you want to capture an event in another workbook. See here

Check if application is not running

I am developing a WiX installer (I am very new to this) and want to implement a method (like launch condition) which check if a particular application is running or not. If it's running then a warning message will popup displaying close the application message. I want this check before the welcome screen.
How can I implement this? Some working example will really help me a lot.
Windows Installer already has a FilesInUse and RMFilesInUse (Restart Manager) support. Does this not meet your needs? With these patterns you'll get a dialog telling the user that they need to exit a program or risk needing a reboot.
This can be done only through a custom action. Here is a tutorial for a C++ DLL native custom action: http://www.codeproject.com/Articles/1747/MSI-Custom-Action-DLL
Your custom action can perform the check and then show a message to the user if necessary. It
can return 0 to continue the installation or 1602 to stop.
To show the message before Welcome dialog, you can try scheduling your custom action right after CostFinalize action in InstallUISequence.

Cancel sharepoint workflow

when cancel sharepoint workflow by web browser or programatically by code
SPWorkflowManager.CancelWorkflow()
All task in my workflow task list was deleted, where i can turn off this, i need this task to reporting.
This is the way SharePoint works, canceling a workflow deletes all related tasks, but the workflow history is kept. Do not rely on tasks as a proof that something did or did not happen.

Resources