Posts

Showing posts from October, 2013

SharePoint 2010 - Items Added By Anonymous Users Cannot Start Workflows

Image
On a public-facing website on SharePoint 2010, I was building a simple list to be used as the Contact Us form, so that when an item is added to the list, a workflow will run which sends an email to the owner of the website. It all worked fine until I tested as an anonymous user that wasn't logged in.  I could create the item fine, but the workflow would not run.  The reason for this is, when an item is created by an anonymous user, the item does not set an author against itself (created by, modified by), which means the Workflow does not know what permissions it should use to run. Turns out there's really only one way to get around this.  Open up your old mate Visual Studio and create an Event Receiver on the ItemAdded event.  What needs to happen is as soon as the item is added to the list, the event receiver will grab the item, and set the Author value to something generic (I used the System Account), then run the workflow. (code in text at the bottom of thi...

Programmers need to KISS

An old teacher once asked me why people think programming is so hard.  Being someone who enjoys it, I couldn't give him a good reason.   His reply was simple.   Programming is not hard.  In fact, there are  FOUR  things you need to understand to be a programmer Programs can run commands sequentially (1 line at a time) They can loop through commands (repeat the same code multiple times) They can handle conditional statements (If, Then, Else) They can transfer control And there are only TWO things that can go wrong Syntax Error Logical Error So next time you get stuck on some mind-blowing complex piece of code, just remember...  K eep I t S imple S tupid.