I have a workflow that is triggered by the creation of a list item and sends out an email when the list item is created.
If I create a new item in that list through the Sharepoint front end it sends the email.
I have a small console application designed to set the list item through the Sharepoint API. This is run as a scheduled task on a daily basis ( the purpose of the list is to nominate someone for a daily rota ) in the middle of the night. The scheduled task is run with the credentials of the Site Collection Administrator for the site.
The list item is added but the workflow is not triggered. In the log I get the following message:
Declarative workflows cannot automatically start if the triggering action was performed by System Account. Canceling workflow auto-start.
It appears as though the list item is being added by the system account rather than the user who is running the code. What do I need to do in order to have my code interact with Sharepoint using the same identity that is running the application?