Enabling E-Mails to Trigger SharePoint List Workflows

Triggering workflows when items have been added to a list is very common. However, Items can be added to lists using a variety of methods and some of those methods will not trigger workflows without some extra configuration steps. This can lead to some confusing workflow behavior when different methods are used to add items to a workflow-enabled list.  This was recently experienced when working with a simple workflow that needed to run whenever any new items were added to a list.  This workflow would copy some of the new items information and use it to create a separate new item in another list.  While seemingly simple to configure there was one little caveat: items needed to be created by having an email sent to the list. The process needed to work like this:

1: An external E-mail is sent to a SharePoint List.
2: When the email arrives it creates a new item in the list.
3: When the new list item is created, it automatically runs an associated workflow.
4: This workflow creates a new item in another list.

While the workflow was simple to construct, the process was stopping at step 3 as the workflow would not trigger.  Strangely enough, however, any items added manually to the list would trigger the workflow and the process would complete successfully. 

The reason for this was determined to be because of a SharePoint Farm-scoped property called: "DeclarativeWorkflowAutoStartOnEmailEnabled."  While the name is a mouthful it accurately describes the issue: If this property is set to false, SharePoint will not allow declarative workflows to automatically start when an item is created via email.

It is quite simple to set this property but it can only be done using stsadm or PowerShell, there is no Central Administration setting for it.  One thing to note is that stsadm is being deprecated so it is recommended to learn and use the PowerShell method.

Resolution (PowerShell)

Open a SharePoint Management Shell as administrator and run the following command to first determine what value the property has: 

$spWebService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService 

$spWebService.DeclarativeWorkflowAutoStartOnEmailEnabled 

This will return either “FALSE” or “TRUE.” If the Value of the property is false, set it to true by entering the following commands: 

$spWebService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService 

$spWebService.DeclarativeWorkflowAutoStartOnEmailEnabled = $true 

$spWebService.Update()

Resolution (Stsadm - depricated) 

Open a command window and run the following command to first determine what value the property has: 

stsadm -o getproperty -pn declarativeworkflowautostartonemailenabled

 

This will return a bit of XML like this:

                <Property Exist=”Yes” Value=”no” />

This indicates that the property is valid and that the value is no (false).

If the value of the property is no/false, enable it by entering the following commands:  

stsadm -o setproperty -pn declarativeworkflowautostartonemailenabled -pv true 

 

 

Posted on Tuesday July 16, 2013
Comments are closed
Powered by Powered by Azure