Update: The first sample was pulled. It no longer works.
Have you checked out the SharePoint 2013 workflow samples from MSDN? I sometimes hesitate to download these because you never know the quality. Some of them don’t even compile without changes. Recently, I found a pair of examples from the Apps for Office and SharePoint Samples that do work with the RTM SharePoint 2013 and latest developer tools, one I had to tweak.
SharePoint 2013 workflow: Workflow-powered app for SharePoint
The sample file was pulled. It was previously at code.msdn.microsoft.com/officeapps/SharePoint-2013-workflow-580034f9/view/Discussions
I had to make a few changes to get this to compile. I replaced a reference to Microsoft.Activity with System.Activity and then I had to fix the XAML for BuildDictionary based on the BuildDictionary I dragged in from the toolbox. After that it would compile against the most recent tools for SharePoint in Visual Studio 2012 on my Windows 8 box with all Windows Updates installed.
What to do after it deploys
There is no walkthrough of the functionality of this app, so I had to decipher the workflow sequence in Visual Studio to see it work. Here are the steps:
- After deploying, click the List1 link on the App Web default.aspx
- create a new item with any title
- refresh the page until the title is replaced with “Workflow1 is waiting”
- edit the item to change the text to Go workflow
- refresh the page until the title is replaced with “Workflow1 is completing”
- go back to default.aspx and click the List2 link
- A new item will have been created in List2 titled “Workflow1 ran on List1”
While I get that this is basically a no-code example that does a lot of stuff, I have a hard time picturing a real time scenario based on this example. The activities in the Workflow editor are fairly complicated to understand and I’m not sure I could repeat them with real data.
Despite this, it’s interesting to me. My favorite part was that I downloaded this on Windows 8, compiled it and deployed it to a free Office 365 Developer Site without touching a SharePoint Server that I had to set up or use local resources for. I also liked that it deployed in the App Model. That is super cool to me because of the removed burden on administrators to worry if this will take down the server.
SharePoint 2013 workflow: Workflow OM in an app for SharePoint
None. Deployed with no changes when I set the url to my Office 365 Developer Site.
What to do after it deploys
Have you tried these examples or had better luck with the other 5 or so Microsoft has provided? Do you know of better code examples? I like to learn through experimenting with existing code like this, so I’m always looking for examples that show me how to do something new. Reply in the comments, email me firstname.lastname@example.org or mention me on twitter @resing.