Saturday, May 20, 2017

Thursday, May 4, 2017

SharePoint 2010/2013: Workflow Invoking on an Email Enabled List

Scenario:
You have an emailed enabled list in SharePoint. You also have a workflow created against the list that is configured to run on both the creation and update of list items. When someone sends an email to the list, you want the workflow to run. You either want to include or exclude the original email.

Default Behavior and Settings
When enabling Incoming Email on a list, the default setting is to include the original email.



If you have a workflow associated with this list with this setting as Yes, that workflow will invoke when a user emails into the list. My particular workflow needed to send all attachments from the email to a particular Exchange mailbox.

My Result
My workflow worked fine. When an email was sent to the list with attachments, my workflow was able to send those attachments to the Exchange mailbox. Included was the original email as an .eml file.

Not Including the Original Email
However, in my scenario, I needed to keep the email anonymous. Therefore, I did not want to include the original email as that would display the original sender. So I switched the Incoming Email setting to No.



Workflow Behavior Without Original Email
Once I did not include the original email, the workflow associated no longer invoked when a user sent an email to the list. Bummer.

Solution
As my director always says, "There's gotta be a setting for that". This is not always the case but in this case I got lucky.

There is a setting that will invoke workflows when a user emails into this list without saving the original email. It is crazy that this setting (and you'll see the name soon) actually exists.

There is a SharePoint Administration setting within the content service that allows declarative workflows (SharePoint Designer) to invoke on email enabled lists. The setting is named DeclarativeWorkflowStartOnEmailEnabled.

No way! Really? This is what I needed. Back in the day this setting was set using stsadm. Nowadays, a few PowerShell statements and you are set (pun intended).



$spWebService = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$spWebService.DeclarativeWorkflowAutoStartOnEmailEnabled= $true
$spWebService.Update()


Yeah baby!

Result
As a result in my scenario, the workflow is now invoked when a user emails into the list without saving the original email. The sending of attachments to the Exchange mailbox no longer includes the original email (.eml) file.




Kudos
Special thanks to my wonderful co-worker Liz Lowry for remembering there was an email setting to not include the original email.


Matched Content