Workflow "Failed on Start" when started via Powershell. Condition not authorized.
-
Wednesday, May 09, 2012 9:20 AM
Hi,
I recently modified a pre-exisiting, pre-working workflow to add a "Is User in a Sharepoint Group" condition from SPDActivities CodePlex project.
Anyway if I initiate the workflow manually it all works correctly (including the new condition). However when in production the workflow gets started via Powershell (which also creates the list item), and instead I get a "Failed to Start" in the SP UI, and in the logs I get the following:
05/09/2012 19:04:58.39 w3wp.exe (0x119C) 0x0F9C SharePoint Foundation Workflow Infrastructure 98d8 Unexpected Microsoft.SharePoint.SPException: <Error><CompilerError Line="0" Column="0" Text="Activity 'ID273' validation failed: Property "Condition" has invalid value. Condition expression is invalid. The type: "DP.Sharepoint.Workflow.Common, DP.Sharepoint.Workflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0298457208daed83" is not authorized for use in Workflow Rules or Conditions" /></Error> at Microsoft.SharePoint.Workflow.SPNoCodeXomlCompiler.LoadXomlAssembly(SPWorkflowAssociation association, SPWeb web) at Microsoft.SharePoint.Workflow.SPWinOeHostServices.LoadDeclarativeAssembly(SPWorkflowAssociation association) at Microsoft.SharePoint.Workflow.SPWinOeHostServices.CreateInstance(SPWorkflow workflow) at Microsoft.SharePoint.Workflow.SPWinOeEngine.RunWo...
05/09/2012 19:04:58.39* w3wp.exe (0x119C) 0x0F9C SharePoint Foundation Workflow Infrastructure 98d8 Unexpected ...rkflow(SPWorkflowHostService host, SPWorkflow workflow, Collection`1 events, TimeSpan timeOut) at Microsoft.SharePoint.Workflow.SPWorkflowManager.RunWorkflowElev(SPWorkflow workflow, Collection`1 events, SPWorkflowRunOptionsInternal runOptions)I checked the web.config (all the posts regarding "not authorized" points to a missing authorizedType entry) and I have the following (in the correct locations):
<SafeControl Assembly="DP.Sharepoint.Workflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0298457208daed83" Namespace="DP.Sharepoint.Workflow.InfoPath" TypeName="*" Safe="True" SafeAgainstScript="False" />
<SafeControl Assembly="DP.Sharepoint.Workflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0298457208daed83" Namespace="DP.Sharepoint.Workflow.Install" TypeName="*" Safe="True" SafeAgainstScript="False" />
<SafeControl Assembly="DP.Sharepoint.Workflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0298457208daed83" Namespace="DP.Sharepoint.Workflow" TypeName="*" Safe="True" SafeAgainstScript="False" /><authorizedType Assembly="DP.Sharepoint.Workflow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0298457208daed83" Namespace="DP.Sharepoint.Workflow" TypeName="*" Authorized="True" />
The Powershell code I use to start them is as follows:
foreach ($wf in $list.WorkflowAssociations | ? { $_.AutoStartCreate -eq $true }) {
$oWeb.Site.WorkflowManager.StartWorkFlow($item, $wf, $wf.AssociationData, [Microsoft.SharePoint.Workflow.SPWorkflowRunOptions]::SynchronousAllowPostpone) | Out-Null
}
Is there another web.config I should be looking at? Any other pointers to what is wrong? Is there another method of checking that a user is a member of a Sharepoint group within a workflow?
Thanks in advance
Peter
All Replies
-
Friday, May 11, 2012 11:26 AMModerator
Hi Peter,
There is an invalid value/expression using in workflow condition, could you please check it, something like a number cannot compare with a string? Check every items uses in condition and see if you can find any problem.
Could you please try to using the sample code to start workflow for one item?
http://www.c-sharpcorner.com/UploadFile/anavijai/how-to-start-the-workflow-for-an-item-using-powershell-in-sharepoint-2010/Or use C# instead?
Thanks & Regards,
Emir
Emir Liu
TechNet Community Support
- Edited by Emir LiuMicrosoft Contingent Staff, Moderator Friday, May 11, 2012 11:35 AM
- Edited by Emir LiuMicrosoft Contingent Staff, Moderator Friday, May 11, 2012 11:38 AM
- Marked As Answer by Emir LiuMicrosoft Contingent Staff, Moderator Thursday, May 17, 2012 5:58 AM

