While terminating or cancelling workflow, it will delete all the tasks from the task list and it will marked task status as “Cancelled” into attached list.
Reference Link:
http://blog.brianfarnhill.com/2008/10/01/how-to-cancel-a-workflow-programmatically/
Tuesday, January 26, 2010
How to terminate/cancel workflow from SharePoint object model
Labels:
cancel workflow,
custom workflow,
delete all the tasks from task list,
How to terminate workflow,
How to terminate workflow from object model,
How to terminate/cancel workflow from object model,
How to terminate/cancel workflow from SharePoint object model,
MOSS 2007,
Personal Experience,
SharePoint,
SharePoint Object Model,
task status as cancelled,
terminate workflow,
visual studio workflow,
Visual Studio Workflow - SharePoint
Visual Studio Approval Workflow Example
http://msdn.microsoft.com/en-us/library/dd674137.aspx
http://msdn.microsoft.com/en-us/library/cc811589.aspx
http://msdn.microsoft.com/en-us/library/cc811589.aspx
How to get workflow instance for single workflow into listitem
Getting access denied error while updating list items
I was getting access denied error while updating list items, I already tried to put my code into SPSecurity.RunWithElevatedPrivileges delegate, still I was getting error. Below was my actual code.
CODE:
//code line for updating list columns
Listitem.update()
List.Update()
After doing debugging and removing line by line from actual code I have figured out actual problem – the user who has contributor rights(normal user) was getting access denied error, admin users can able to update list without any problem, it’s because of LIST.UPDATE() statement, because contributor rights users don’t have permission to change anything into List settings, they can add/delete list items but they can’t able to change anything into list, after removing LIST.UPDATE() statement from my actual code, all users were able to successfully update the list items.
Enjoy!
CODE:
//code line for updating list columns
Listitem.update()
List.Update()
After doing debugging and removing line by line from actual code I have figured out actual problem – the user who has contributor rights(normal user) was getting access denied error, admin users can able to update list without any problem, it’s because of LIST.UPDATE() statement, because contributor rights users don’t have permission to change anything into List settings, they can add/delete list items but they can’t able to change anything into list, after removing LIST.UPDATE() statement from my actual code, all users were able to successfully update the list items.
Enjoy!
Labels:
Access denied,
access denied in list item,
Getting access denied error while updating list items,
List Settings,
List.Update(),
Listitem.update(),
MOSS 2007,
Personal Experience,
SharePoint,
SharePoint List,
SharePoint Object Model,
SPSecurity.Runwithelevatedprivileges,
SPSecurity.RunWithElevatedPrivileges delegate,
updating list items
ERROR: Workflow failed on start
I was getting below error while starting of workflow.
Workflow:System.Workflow.ComponentModel.Compiler.WorkflowValidationFailedException: The workflow failed validation. at System.Workflow.Runtime.WorkflowDefinitionDispenser.ValidateDefinition(Activity root, Boolean isNewType, ITypeProvider typeProvider) at System.Workflow.Runtime.WorkflowDefinitionDispenser.LoadRootActivity(Type workflowType, Boolean createDefinition, Boolean initForRuntime) at System.Workflow.Runtime.WorkflowDefinitionDispenser.GetRootActivity(Type workflowType, Boolean createNew, Boolean initForRuntime) at System.Workflow.Runtime.WorkflowRuntime.InitializeExecutor(Guid instanceId, CreationContext context, WorkflowExecutor executor, WorkflowInstance workflowInstance) at System.Workflow.Runtime.WorkflowRuntime.Load(Guid key, CreationContext
I spend lots of time to find out exact resolution for workflow failed error, but I couldn’t get solution, below are some of the reference link which talks causing of issue due to migration from visual studio 2005 to 2008 workflow project, but in my case, I have created workflow into visual studio 2008 only, some articles were talking about adding some line into solution project, but that’s also not working for me.
Reference Link:
http://blog.hhebnes.no/?tag=/workflows
http://www.eggheadcafe.com/software/aspnet/31975863/sharepoint-workflow-upgra.aspx
http://geekswithblogs.net/SoftwareDoneRight/archive/2007/12/12/condition-not-found.aspx
At the last for resolving my issue, I have created new workflow file, one thing I have observed here – if I am going to change main default file name for workflow file from workflow.cs to something else, then sometime it will mess up workflow. So I would recommend not changing workflow.cs file name.
:)
Workflow:System.Workflow.ComponentModel.Compiler.WorkflowValidationFailedException: The workflow failed validation. at System.Workflow.Runtime.WorkflowDefinitionDispenser.ValidateDefinition(Activity root, Boolean isNewType, ITypeProvider typeProvider) at System.Workflow.Runtime.WorkflowDefinitionDispenser.LoadRootActivity(Type workflowType, Boolean createDefinition, Boolean initForRuntime) at System.Workflow.Runtime.WorkflowDefinitionDispenser.GetRootActivity(Type workflowType, Boolean createNew, Boolean initForRuntime) at System.Workflow.Runtime.WorkflowRuntime.InitializeExecutor(Guid instanceId, CreationContext context, WorkflowExecutor executor, WorkflowInstance workflowInstance) at System.Workflow.Runtime.WorkflowRuntime.Load(Guid key, CreationContext
I spend lots of time to find out exact resolution for workflow failed error, but I couldn’t get solution, below are some of the reference link which talks causing of issue due to migration from visual studio 2005 to 2008 workflow project, but in my case, I have created workflow into visual studio 2008 only, some articles were talking about adding some line into solution project, but that’s also not working for me.
Reference Link:
http://blog.hhebnes.no/?tag=/workflows
http://www.eggheadcafe.com/software/aspnet/31975863/sharepoint-workflow-upgra.aspx
http://geekswithblogs.net/SoftwareDoneRight/archive/2007/12/12/condition-not-found.aspx
At the last for resolving my issue, I have created new workflow file, one thing I have observed here – if I am going to change main default file name for workflow file from workflow.cs to something else, then sometime it will mess up workflow. So I would recommend not changing workflow.cs file name.
:)
Labels:
custom workflow,
migration from visual studio 2005 to 2008 workflow project,
MOSS 2007,
not changing workflow.cs file name,
Personal Experience,
SharePoint,
SharePoint Object Model,
Sharepoint Problems,
starting of workflow,
The workflow failed validation,
visual studio 2005 workflow,
visual studio 2008 workflow,
visual studio workflow,
Visual Studio Workflow - SharePoint,
Workflow Errors,
Workflow failed on start,
workflow.cs
How to get current status of workflow from SharePoint object model
Reference Link:
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.workflow.spworkflowstatus.aspx
Sample Code:
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.workflow.spworkflowstatus.aspx
Sample Code:
//Obtain a list item
SPWeb thisWeb = SPControl.GetContextWeb(Context);
SPList issuesList = thisWeb.Lists["Customer Issues"];
SPListItem myItem = issuesList.Items[0];
//Get the workflow status value
int WorkflowStatusValue = myItem["MyWorkflow"];
string WorkflowStatusString = System.Enum.GetName
(typeof(SPWorkflowStatus), WorkflowStatusValue);
StatusLabel.Text = "The current status of the workflow is: " +
WorkflowStatusString;
Labels:
custom workflow,
How to get current status of workflow,
How to get current status of workflow from SharePoint object model,
MOSS 2007,
SharePoint,
SharePoint List,
SharePoint Object Model,
SPList,
SPListItem,
SPWEB,
SPWorkflowStatus,
status of workflow,
System.Enum.GetName,
visual studio workflow,
Visual Studio Workflow - SharePoint
SPWorkflow AlterTask didn’t work with hash table which has space into key name
While creating hash table for passing into altertask method, we need to be very careful, because it didn’t like spaces into key name, we need to put our key without spaces.
Sample Code:
taskHash["UserInputField"] = UserInputField.Text;
taskHash["UserInputField_ForHash"] = UserInputField.Text;
taskHash["Status"] = "Completed";
taskHash["Status_ForHash"] = "Completed";
SPWorkflowTask.AlterTask(taskListItem, taskHash, true);
Reference Link:
http://www.databaseforum.info/10/1131769.aspx
Sample Code:
taskHash["UserInputField"] = UserInputField.Text;
taskHash["UserInputField_ForHash"] = UserInputField.Text;
taskHash["Status"] = "Completed";
taskHash["Status_ForHash"] = "Completed";
SPWorkflowTask.AlterTask(taskListItem, taskHash, true);
Reference Link:
http://www.databaseforum.info/10/1131769.aspx
Labels:
altertask,
custom workflow,
hash table into altertask,
MOSS 2007,
Personal Experience,
SharePoint,
Sharepoint Problems,
SPWorkflow AlterTask didn’t work with hash table which has space into key name,
SPWorkflowTask,
SPWorkflowTask.AlterTask,
visual studio workflow,
Visual Studio Workflow - SharePoint,
Workflow Errors
ERROR: The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again
I was getting above error while doing altertask on SPWorkflowTask.AlterTask method.
Solution: we need to write altertask code under SPSecurity delegate and need to write code for Allowunsafeaccess.
http://sansanwal.blogspot.com/2009/08/security-validation-for-this-page-is.html
http://support.microsoft.com/default.aspx?scid=kb;EN-US;970192
Solution: we need to write altertask code under SPSecurity delegate and need to write code for Allowunsafeaccess.
http://sansanwal.blogspot.com/2009/08/security-validation-for-this-page-is.html
http://support.microsoft.com/default.aspx?scid=kb;EN-US;970192
Labels:
allowunsafeaccess,
altertask,
custom workflow,
MOSS 2007,
Personal Experience,
SharePoint,
Sharepoint Problems,
spsecurity,
spsecurity delegate,
SPWorkflowTask.AlterTask,
The security validation for this page is invalid. Click Back in your Web browser refresh the page and try your operation again,
visual studio workflow,
Visual Studio Workflow - SharePoint,
Workflow Errors
ERROR: The content type of a workflow task must be derived from the Workflow Task content type
I was getting “The content type of a workflow task must be derived from the Workflow Task content type” error while working with custom ASPX form for visual studio workflow, I have created custom content type which will be used into workflow, I have found out that my content type ID is incorrect by comparing it with some another content type ID. Visual studio activity “Createtaskwithcontenttype” must be inherited from workflow task.
Reference Links:
http://www.eggheadcafe.com/software/aspnet/30858987/login.aspx
http://social.msdn.microsoft.com/Forums/en-US/sharepointworkflow/thread/93679b02-bfa9-43c2-94ad-ec45191cd478
Reference Links:
http://www.eggheadcafe.com/software/aspnet/30858987/login.aspx
http://social.msdn.microsoft.com/Forums/en-US/sharepointworkflow/thread/93679b02-bfa9-43c2-94ad-ec45191cd478
Labels:
content type ID,
Createtaskwithcontenttype,
custom ASPX,
custom content type,
custom workflow,
MOSS 2007,
Personal Experience,
SharePoint,
Sharepoint Problems,
The content type of a workflow task must be derived from the Workflow Task content type,
visual studio workflow,
Visual Studio Workflow - SharePoint,
Workflow Errors,
workflow task,
Workflow Task content type
Subscribe to:
Posts (Atom)