Creating a SharePoint Workflow

I wrote two previous blog posts about creating workflows with SharePoint Designer:

What are SharePoint Workflows

and

SharePoint Workflows – first steps

This post follows on from those.

In this case we’ll create a simple workflow that sends an email when a document is added to the library.

clip_image002

Firstly give the workflow a name and a description and then select the platform type (which you normally leave set as SharePoint 2013 Workflow) and press the OK button to create the workflow.

SharePoint 2013 allows you to create either SharePoint 2010 or 2013 Workflows. Each has differences and the following:

What’s new in workflow in SharePoint 2013

Is the recommended place to start when it comes to understanding the differences between the versions. In most cases you will want to work with SharePoint 2013 Workflows.

clip_image004

This now takes you to a location where you can edit and create the workflow.

For a SharePoint 2013 Workflow you will see a stage box or “block” divided up into two sections. The upper box is for a set of Actions and the lower box (Transition to stage) which allows you to jump to other stages you may have created. This Transition to stage is a unique feature of SharePoint 2013 workflows and allows you to bypass code by ‘jumping’ to certain locations.

You should also see a blinking cursor under the top section as shown above. You position this cursor where you wish to insert a command in the workflow.

clip_image007

In the Ribbon Bar you should see a number of buttons contained in the Insert section as shown above. Press the Action button to insert an execute command.

clip_image010

When you press the Action button you will see a list of all the actions that can be taken, as shown above. Scroll through the list until you locate Send an Email and select it.

clip_image013

You should now see that command displayed in the workflow area below in the location where your cursor was as you can see above. The cursor now moves to the line just below what you inserted.

You will also note that the text these users is hyperlinked. This indicates that additional details are required for this command to complete. In this case you will need to specify the email address that you wish the email to be sent to. To do that simply press the hyperlinked text these users.

clip_image015

Now the additional settings for each Action will vary. In this case you should now see a dialog as shown above, basically asking you to complete the details for the email.

clip_image017

There are plenty of options that can be configured here (including data lookup) but we’ll keep this simple and plug in just an email address, subject and some text in the body.

When complete, press the OK button to save.

clip_image020

You should now see that the workflow action has updated with the email address you entered. You can modify these properties again at any time by simply clicking on the hyperlinked email address.

clip_image023

Although this is the only command that will be run by the workflow at this stage it is good practice to correctly terminate the workflow. To do this, click once in the Transition to stage area so the cursor appears there as shown above.

clip_image026

Select the Action button again from the Ribbon Menu. From the menu that appears select Go to a stage.

clip_image029

Once again, this will place the Action in the workflow window as shown above.

To complete the options for the Action select the hyperlinked text a stage.

clip_image032

From the drop down menu that appears select End of Workflow. Doing so will ensure that the workflow does not continue to run in the background consuming resources.

clip_image034

The completed workflow should now look like the above.

clip_image036

You now need to set the workflow so it runs whenever something new is added to the Document Library. To do this locate the Workflow Settings button in the Ribbon Menu in the Manage section and select it.

clip_image039

On the right hand side you will see a box called Start Options as shown above. Place a check in the Start workflow automatically when an item is created.

clip_image041

If you need to return to your workflow and edit it select the Edit Workflow button under the Edit section on the Ribbon Menu.

You can also Save your workflow if need be but in this case we are ready to Publish to the SharePoint site so we select the Publish button from the Ribbon Menu.

clip_image043

You should now see the workflow being Published to the SharePoint site. If there are any errors you will be notified and have to make changes.

If there are not errors, your workflow has been successfully Published to SharePoint.

You can check that your SharePoint element has a workflow attached to it by navigating to that location (in this case Documents).

clip_image046

If you then select the Library tab at the top of the page.

clip_image048

Then the Workflow Settings button on the very right of this.

clip_image051

You should then see the name of the Workflow you just created.

clip_image055

If you look closely at the SharePoint element that now has a workflow attached you will see an additional column has been added to the default view. This column is the same as the name of your workflow (in this case Send email workflow as shown above).

clip_image034[1]

When you trigger a workflow (in this case by uploading a new document) the new workflow column will report what stage the workflow is at. Remember, that each “block” of Actions and Transition to stage is designated by its name.

In this example, there is only one code “block” called Stage 1 as shown above. Thus, when the workflow is triggered by the addition of a new document to the element the workflow executes and start and ends on Stage 1. This status is then reported in the workflow column in the SharePoint element. This allows you to more easily debug your code since it allows you to easily see where a workflow is currently situated.

clip_image057

As you can see from the above, the workflow was completed and an email has been sent with the subject and text created in the workflow.

You can now return and edit the workflow and create additional Actions. You can create additional workflows for the same elements if you wish or you can create them for other elements.

Conclusions

SharePoint workflows provide the ability to automate processed in SharePoint. However, workflows are not like pure coding, they are more like constructing a flow chart. They are great for simple and straight forward processes but become quite cumbersome and difficult to create when the task gets complex or involved.

Best practice is always to map out your workflow prior to developing with SharePoint Designer. Keep your code as simple as possible and make sure you maintain good documentation elsewhere about what you have created because SharePoint Designer doesn’t provide for adding comments to your code.

If you ever need to debug a workflow, break it down and look at the stages that are reported in the SharePoint element to which the workflow is attached. Also, don’t overlook the workflow start conditions. If you set a workflow to commence when something changes, that means when ANYTHING changes. That may mean you have multiple workflows running at the same time causing confusion. That is why it is so important that you programmatically terminate your workflow upon completion, rather than simply letting the process end.

Use correctly, SharePoint Designer and workflow can be huge source of productivity improvements. Use incorrectly or poorly implemented they can be a huge source of frustration. Remember, SharePoint Designer is not the only tool that you can use to create workflows. You can use Visual Studio for far greater control, but for that there is a much greater investment in both time, material and knowledge. SharePoint Designer allows a balance to be struck and be used by people who aren’t software developers.

Smarter help when editing with Office Online

Here’s something I just learnt that I think is really, really helpful.

image

Click on a Microsoft Office document somewhere in SharePoint Online (Team Site or OneDrive for Business). It will then open that document in a browser using Office Online. If you then elect to edit that document in a browser you’ll see the familiar ribbon as shown above.

image

See that box at the top of the ribbon that says ‘Tell me what to do’?

image

If I type ‘create table’, as you can see that menu option immediately becomes available, allowing me to select and create a table.

image

If I instead type in the box ‘create grid’, Office Online works out that I probably mean table and again shows me the appropriate menu command right there so I can create my table.

This is very powerful as it allows people to find what they are after much quicker and reduces the needs for lots and lots of menus and buttons.

Use it, love it.

Office 365 email attachments into OneDrive

A little while ago I noted in a blog post how the ability to select an attachment that was already in your OneDrive for Business was being rolled out.

image

After watching the latest Garage Series video I note that you can elect to upload a file from your desktop machine and attach it to an email as you used to BUT NOW you can also upload it directly into your OneDrive for Business as you see with the top button above!

image

It then displays the file in the email as you see above but that is simply a pointer to the location in OneDive for Business where the file actually lives.

However, even better than that, all the people you send the email with the attachment to automatically have the appropriate rights set in OneDrive for Business. All the external sharing business is ‘automagically’ taken care of! Impressive.

It seems that this is only available via Outlook Web Access. It would be nice if it was also available via Outlook on the desktop but I wouldn’t expect that initially. Down the track? Yes, probably but for now whata great addition.

https://www.youtube.com/watch?v=SP_H4TUfzjg

As always, I recommend you watch the latest Garage Series video to learn about everything that is happening with Office 365.

Self Organizing Learning Environments

I found this video very inspiring, thought provoking and I commend everyone to take the time to watch it. The premise is that perhaps we don’t need schools to educate people. Perhaps all we need is a connection to the Internet. The results can be truly amazing.

Where I originally came across Sugata Mitra was in a Microsoft Surface video. He teams up with another passionate educator, Adam Braun (another inspiring story – Pencils of Promise, that I also commend you to watch), to discuss education needs based on Mitra’s research.

The Work Wonders Project video above demonstrates how Mitra’s concept of Self Organizing Learning Enterprises (SOLE) can work in a normal school. It is really amazing at how engaging it can be for the students and how well it works.

Technology and the web obviously play a big part in SOLE but for all the bad stuff and commercialization we see with technology, I think this SOLE concept shows real promise not only in schools but anywhere.

In that respect, I think businesses could use SOLE to greatly increase their productivity and employee engagement. I urge you to take a look at these two video and ask yourself whether the SOLE concept could be applied somewhere in you life?

Resolving OneDrive for Business file conflicts

In a recent post:

Working with OneDrive for Business offline

I highlighted a scenario where if a user edited files synced with OneDrive for Business desktop app offline while another user edited those same files online, when the first user tried to sync, after coming back online, they would get an error. This could also potentially result the loss of one of the copies of the changed document.

I believe I have a solution to solve that issue so let me run through it here. So here’s the scenario first.

image

Robert is using OneDrive for Business in Office 365 and has a number of files as you can see above stored in there and accessible via a browser.

image

He has shared a document ‘cloud qualification worksheet’ with user Lewis Collins directly from his OneDrive for Business, as you can see above. Robert has also allowed Lewis the ability to edit this document.

image

Robert has also synced his OneDrive for Business to his local laptop using the free desktop app and all the files are up to date as you can now see from the above screen shot.

image

Lewis can work with the document in Word or using Office Online.

image

Robert can do the same and because both are online any changes get replicated to both users and to Robert’s desktop.

Ensuring that all his OneDrive for Business documents are synced and up to date Robert gets on a plane and goes offline.

image

While offline, Robert opens the file from his desktop and makes the changes you see above. This means the file in his desktop version of OneDrive from Business is different from the original.

image

While Robert is offline, Lewis also goes into the same file and changes it as shown above. Because he remained online, this version now becomes the one that is saved into Office 365.

So now we have 2 different versions of the same file. One is in Office 365 and one is on an offline notebook.

Robert completes his travel and goes back online.

image

At the next sync, the desktop app now indicates an error, because the file in Office 365 has been edited by someone else and so has the local copy. It therefore displays a sync error on that file as shown above, indicated by a red icon on the file on Robert’s notebook.

image

If Robert now right mouse clicks on the file with the error and selects the OneDrive for Business option and the View sync problems option from there he sees:

image

At this point you need to be careful of what you do to retain both copies of the file so you can manually merge the changes.

Step 1 – Copy the original offline edited file

On his laptop Robert need’s to take a copy of the file that is displaying the error and allow it to sync back to Office 365.

image

As you can see, now on his local machine he now has the original file with the error and a copy of it synced to Office 365.

image

If he now navigates to his OneDrive for Business via the browser he sees this new file is also in the cloud.

Step 2 – Delete the original offline file

Returning to his laptop, Robert now deletes the file with the error from the OneDrive for Business location on his laptop. Remember, he has already made a copy of this file before deleting it.

image

His laptop now looks like the above with no errors and all files synced.

image

As expected, when he refreshes his browser he see exactly the same thing in his OneDrive for Business in Office 365.

image

If he opens the copy of the file he made, Robert sees that it has all the changes he made while offline as shown above. The original file is now not in either location, that is why you need to copy the offline edited version first and allow it to sync.

Step 3 – Restore the deleted file from the Recycle Bin via the browser

image

From OneDrive for Business in the browser Robert selects the Recycle Bin link on the left.

image

From the Recycle Bin Robert selects the file he just deleted in his desktop and then selects Restore Selection.

image

He confirms the restore by pressing OK.

image

If Robert then returns to his OneDrive for Business by selecting the My Documents link on the top left he will see that the original file has not only been restored but it is also still shared!

image

If Robert now views that file in a browser he sees that it contains the edits that Lewis made online as shown above.

image

In a matter of moments that restored file synced to his desktop using the desktop sync app as shown above.

image

He can now open the file from his desktop and merge the changes with his original (which is saved as a copy here as well) and then update the original back to Office 365, while retaining all the user sharing he enabled earlier.

Summary

So if you get a conflict with a file that has been changed in the cloud and on a synced desktop performed the following:

1. Create a copy of the desktop file saved to OneDrive for Business.

2. Delete the desktop file from the local machine.

3. Restore the file from the recycle bin via the browser and OneDrive for Business online.

That process will allow you to retain a copy of both files as well as the original OneDrive for Business sharing.

I am sure there are other ways of doing this but this worked for me. It is important to follow the process in that order and from the right locations, otherwise you risk losing one of these files.

Hopefully, an upcoming iteration of OneDrive for Business will do this auto-magically for you, however until then this should do the trick for those occasional times when two people edited the same file while one of them was offline.

Windows 7 and 8 machines come to Azure

image

Oh man, this blog is currently turning into the ‘I love Azure’ site isn’t it? But WOW, here’s another announcement that is a game changer in my mind.

Microsoft Azure now has Windows 7 and 8 virtual machines as you can see from the above screen shot. Before this I was using Windows Server 2012 as a workstation to have a ‘clean’ machine to test and demo Office 365.

With the availability of these new desktop Windows systems I can create an even more EXACT test/demo installation in the cloud. This is BRILLIANT since I can now dozens of machines in Azure to test all sorts of scenarios. I would have run out of disk space long ago if even attempted this on my workstation.

Here’s another thing to ponder. if Windows desktop systems are now available via Azure how far away can a full blown Virtual Desktop Offering be? How long can it be before this Virtual Desktop becomes an option in Office 365? My guess? Not long.

Enough. I’m off to spin up more Azure demo machines. What can I say? I love Azure more and more every day!

Clarification – I overlooked the fact that these images are currently only available to MSDN subscribers. Also these images are not meant for production just testing. However, none the less, it certain tells me where all this is going.

Bye bye tower

WP_20140615_006 (1)

For over 8 years I’ve used the above tower machine in a range of roles. I bought it for around $800 initially and used it to run my Hyper-V servers, both production and testing. I eliminated the production requirements of the Hyper V machine by moving them to the cloud (e.g, this blog used to run on a SharePoint site I had running on that machine). The test machines I migrated on Virtual Box running on a big HP Envy 17” laptop so they would be at least portable.

Once its life as a Hyper V host was over I reprovisioned the box to run Windows desktop operating system for a while.

Recently, I was considering getting a replacement for this machine to run everything plus some more virtual testing machines. However, as I outlined in this blog post:

I finally get Azure

When I stopped and thought about what I actually wanted to do I realized I could do everything I needed to in the cloud using something like Azure for the high end grunt for my virtual testing environment.

That meant I no longer needed to spend the $2,500 or so buying a new desktop, Azure would be far more cost effective since I simply turn off the the Azure virtual machines when I don’t need them so it costs me next to nothing.

After that epiphany, and without the need to replace this tower, my thoughts turned to whether I actually needed that machine at all. To make sure, I switched it off and started to use my Surface Pro as my main machine.

After two weeks, and having not turned the old tower box on, I knew I no longer required its services. It has now been wiped and is appearing on eBay looking for a new owner.

This $800 piece of hardware as served me well over the years. In that time it only blew its power supply twice for a grand total of about $150 for parts to repair. When I bought the box initially I toyed with the idea of buying a name brand server and building my ‘date centre’ on that but then I decided to take the opposite path and get the cheapest thing possible and see how long it lasted.

Well 8 years later it is running without an issue and would make anyone a fine workstation. But you know what? This machine has once again confirmed to me why the cloud is fast becoming the solution for more and more IT ‘stuff’. So much so that I no longer need this tower machine, I can use my Surface, Azure and Office 365.

Since I have simplified my own IT and moved more stuff to the cloud I have have cut my power bill by more than 50%. I expect that to fall even further without this tower machine being on most of the day. I have more space under my desk, my office is less noisy and I don’t keep kicking it accidentally either!

This however is not the end of my minimization quest. Next on the list is my long serving HP Envy 17”, which currently needs an external fan blowing on it to keep it cool enough to rest your hand on. With all my testing machine now in Azure and accessible on any device just about I no longer have need for it either. So when I can get a Surface 3 Pro that HP machine will also be looking for a new home.

When I take look back to the time when I had over 6 independent servers running on unique hardware doing different things, a desktop, a laptop, etc to what minimal equipment I have now but with more power, functionality and flexibility thanks to the cloud, I can only imagine what the future holds.

However, like I said, my process is not complete yet. The HP Envy 17” is now on borrowed time and I look forward to further falls in my next electricity bill.