Task List types in SharePoint Online and how to use them in SharePoint Designer workflows

If you are still working with SharePoint Designer workflows, you will be familiar with a setting that has to be made for each workflow: the associated Task list.
Strangely, you need to set this even if your workflow isn’t creating any tasks.

If you open the Task list drop-down, SharePoint Designer will propose the available task list – if any are available – and an option to create a new Task list.

tasklistdropdown

As you will probably know, there are two platform types available in SharePoint Designer 2013: you can create SharePoint 2013 workflows and you can still create SharePoint 2010 workflows. The latter option is still very relevant, because several useful functions like creating a copy of a document only exist in SP2010 workflows.

While working on a SharePoint Online site which has both SP2010 and SP2013 workflows, I noticed a difference in the Task lists that were being offered in the dropdown, which I couldn’t explain at first.

Then it dawned on me: SharePoint 2010 workflows come from the age of SharePoint 2010 (obviously). If you would create a Task list through the browser in SharePoint 2010, you get a different Task list compared to the one that you create through the browser in SharePoint 2013!
As a result, if you create a SharePoint 2010 workflow (in SharePoint Designer 2013) and a SP2010-style Task list is available, that is the one the dropdown will offer you.
A SharePoint 2013 workflow on the other hand will offer you both the SP2010 and SP2013-style Task lists.

You can use a SP2010 workflow with a SP2013-style Task list, but that has another nasty side-effect: the Task list is then automatically populated with a number of old-school content types, like “SharePoint Server Workflow Task” (yes, even in SharePoint Online), and all of the fields that come with it.

Another unpleasant side-effect: the SP2013 version of the Task list has several additional options, like displaying a timeline and a strikethrough option for completed tasks. But if you associate a SP2010 workflow with a SP2013-style Task list, some of those options will not work anymore (found this out the hard way).

So how do you handle this? If you have both SP2010 and SP2013 SharePoint Designer workflows on your site, my recommendation is that you create two Task lists:

  1. a SP2010-style Task list for the SP2010 workflow tasks
  2. a SP2013-style Task list for the SP2013 workflow tasks

That way each workflow gets the appropriate Task list capabilities.

Now here’s the trick: if you create a Task list through the browser in SharePoint 2013 or above – so also in SharePoint Online – you will always get the SP2013-style Task list.
The SP2010-style Task list is still available though, but you will need to create the list through script.
The main distinction to remember:

  • SP2010 Task list = TemplateType 107
  • SP2013 Task list = TemplateType 171

So now you can do something like this in CSOM:

#get the context (request the site, user and password parameters from the user)
$context = New-Object Microsoft.SharePoint.Client.ClientContext($site)
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($user, $password)
$context.Credentials = $credentials

#now we can prepare the new list object
$listCreationInformation = New-Object Microsoft.SharePoint.Client.ListCreationInformation
$listCreationInformation.Title = “My Old School SP2010 Task List”
$listCreationInformation.Description = “My Old School SP2010 Task List”
$listCreationInformation.TemplateType = 107

#then we create the list in our web site context
$list = $context.Web.Lists.Add($listCreationInformation)
$context.Load($list)
$context.executeQuery()

And voila, you have a custom-made SP2010-style list in your SharePoint Online site.
The SP2013-style list can obviously be created in the same way, or through the browser if you like.

Versioning in SharePoint when editing in Word compared to Word Online

While I was developing a workflow to be triggered on a changed Document Library item in SharePoint Online (this was a Word document), I noticed something interesting about the versioning.
In the workflow I was checking if the version number had already increased, thinking that in this way I could determine if the user was done editing.

As it turns out, it depends if you are using Word or Word Online. What happens is this:
If you are using your local MS Word installation, then you are basically working offline. You only connect to SharePoint Online when you take an explicit action like saving or checking-in a document. SharePoint will not create a new version in the version history until you click Save in Word. So even if you type lots of new text and update some properties, but close the document without saving, nothing is changed in the version history.

This is very different in Word Online. As you probably know, there is no Save button in Word Online, because any change is automatically saved for you. So that made me wonder: if I edit a document in Word Online for half an hour, making many changes, then that document is going to be saved automatically dozens of times. So does that create dozens of new versions in the history? Well, that would be awkward and luckily the answer is no.

What happens is that Word Online creates a new version in the version history (in SharePoint Online) when the first change is being saved in Word Online. So as long as you don’t touch anything in Word Online and just read the document, you get no new version. Then, on every next change in the document that is saved in Word Online, that same new version is *updated*. You can see the Modified time change in the version history.
That is actually the same behavior that we are used to in (local) Word: as long as you do not close the document, subsequent saves will be considered as an update to the same version. This is true if you use both minor and major versions, but also if you only use major versions.

So coming back to my workflow, the downside here is that a new version in the history does not always mean that the user explicitly saved his work. That depends if Word Online or (local) Word was used. Your new version will in any case appear in your version history more quickly when using Word Online.